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 @@ -2444,8 +2444,21 @@ changes:
2444
2444
* ` callback ` {Function}
2445
2445
* ` err ` {Error}
2446
2446
2447
- Asynchronous unlink(2). No arguments other than a possible exception are given
2448
- to the completion callback.
2447
+ Asynchronously removes a file or symbolic link. No arguments other than a
2448
+ possible exception are given to the completion callback.
2449
+
2450
+ ``` js
2451
+ // Assuming that 'path/file.txt' is a regular file.
2452
+ fs .unlink (' path/file.txt' , (err ) => {
2453
+ if (err) throw err;
2454
+ console .log (' path/file.txt was deleted' );
2455
+ });
2456
+ ```
2457
+
2458
+ ` fs.unlink() ` will not work on a directory, empty or otherwise. To remove a
2459
+ directory, use [ ` fs.rmdir() ` ] [ ] .
2460
+
2461
+ See also: unlink(2)
2449
2462
2450
2463
## fs.unlinkSync(path)
2451
2464
<!-- YAML
@@ -3173,6 +3186,7 @@ The following constants are meant for use with the [`fs.Stats`][] object's
3173
3186
[ `fs.read()` ] : #fs_fs_read_fd_buffer_offset_length_position_callback
3174
3187
[ `fs.readFile()` ] : #fs_fs_readfile_path_options_callback
3175
3188
[ `fs.readFileSync()` ] : #fs_fs_readfilesync_path_options
3189
+ [ `fs.rmdir()` ] : #fs_fs_rmdir_path_callback
3176
3190
[ `fs.stat()` ] : #fs_fs_stat_path_callback
3177
3191
[ `fs.utimes()` ] : #fs_fs_utimes_path_atime_mtime_callback
3178
3192
[ `fs.watch()` ] : #fs_fs_watch_filename_options_listener
You can’t perform that action at this time.
0 commit comments