File tree 1 file changed +16
-2
lines changed
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -2736,8 +2736,21 @@ changes:
2736
2736
* ` callback ` {Function}
2737
2737
* ` err ` {Error}
2738
2738
2739
- Asynchronous unlink(2). No arguments other than a possible exception are given
2740
- to the completion callback.
2739
+ Asynchronously removes a file or symbolic link. No arguments other than a
2740
+ possible exception are given to the completion callback.
2741
+
2742
+ ``` js
2743
+ // Assuming that 'path/file.txt' is a regular file.
2744
+ fs .unlink (' path/file.txt' , (err ) => {
2745
+ if (err) throw err;
2746
+ console .log (' path/file.txt was deleted' );
2747
+ });
2748
+ ```
2749
+
2750
+ ` fs.unlink() ` will not work on a directory, empty or otherwise. To remove a
2751
+ directory, use [ ` fs.rmdir() ` ] [ ] .
2752
+
2753
+ See also: unlink(2)
2741
2754
2742
2755
## fs.unlinkSync(path)
2743
2756
<!-- YAML
@@ -3466,6 +3479,7 @@ The following constants are meant for use with the [`fs.Stats`][] object's
3466
3479
[ `fs.read()` ] : #fs_fs_read_fd_buffer_offset_length_position_callback
3467
3480
[ `fs.readFile()` ] : #fs_fs_readfile_path_options_callback
3468
3481
[ `fs.readFileSync()` ] : #fs_fs_readfilesync_path_options
3482
+ [ `fs.rmdir()` ] : #fs_fs_rmdir_path_callback
3469
3483
[ `fs.stat()` ] : #fs_fs_stat_path_callback
3470
3484
[ `fs.utimes()` ] : #fs_fs_utimes_path_atime_mtime_callback
3471
3485
[ `fs.watch()` ] : #fs_fs_watch_filename_options_listener
You can’t perform that action at this time.
0 commit comments