diff --git a/doc/api/fs.md b/doc/api/fs.md index 687865e27dc8cc..1d5679d5a4c374 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2736,8 +2736,21 @@ changes: * `callback` {Function} * `err` {Error} -Asynchronous unlink(2). No arguments other than a possible exception are given -to the completion callback. +Asynchronously removes a file or symbolic link. No arguments other than a +possible exception are given to the completion callback. + +```js +// Assuming that 'path/file.txt' is a regular file. +fs.unlink('path/file.txt', (err) => { + if (err) throw err; + console.log('path/file.txt was deleted'); +}); +``` + +`fs.unlink()` will not work on a directory, empty or otherwise. To remove a +directory, use [`fs.rmdir()`][]. + +See also: unlink(2) ## fs.unlinkSync(path)