Skip to content

Commit 8664ec6

Browse files
matejkrajcovicMylesBorins
authored andcommitted
doc: add callback function signatures in fs.md
PR-URL: #13424 Refs: #11135 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 955348e commit 8664ec6

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

doc/api/fs.md

+56
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ changes:
448448
* `path` {string|Buffer|URL}
449449
* `mode` {integer} **Default:** `fs.constants.F_OK`
450450
* `callback` {Function}
451+
* `err` {Error}
451452

452453
Tests a user's permissions for the file or directory specified by `path`.
453454
The `mode` argument is an optional integer that specifies the accessibility
@@ -600,6 +601,7 @@ changes:
600601
* `mode` {integer} **Default:** `0o666`
601602
* `flag` {string} **Default:** `'a'`
602603
* `callback` {Function}
604+
* `err` {Error}
603605

604606
Asynchronously append data to a file, creating the file if it does not yet exist.
605607
`data` can be a string or a buffer.
@@ -662,6 +664,7 @@ changes:
662664
* `path` {string|Buffer|URL}
663665
* `mode` {integer}
664666
* `callback` {Function}
667+
* `err` {Error}
665668

666669
Asynchronous chmod(2). No arguments other than a possible exception are given
667670
to the completion callback.
@@ -699,6 +702,7 @@ changes:
699702
* `uid` {integer}
700703
* `gid` {integer}
701704
* `callback` {Function}
705+
* `err` {Error}
702706

703707
Asynchronous chown(2). No arguments other than a possible exception are given
704708
to the completion callback.
@@ -731,6 +735,7 @@ changes:
731735

732736
* `fd` {integer}
733737
* `callback` {Function}
738+
* `err` {Error}
734739

735740
Asynchronous close(2). No arguments other than a possible exception are given
736741
to the completion callback.
@@ -980,6 +985,7 @@ deprecated: v1.0.0
980985
981986
* `path` {string|Buffer|URL}
982987
* `callback` {Function}
988+
* `exists` {Boolean}
983989

984990
Test whether or not the given path exists by checking with the file system.
985991
Then call the `callback` argument with either true or false. Example:
@@ -1108,6 +1114,7 @@ changes:
11081114
* `fd` {integer}
11091115
* `mode` {integer}
11101116
* `callback` {Function}
1117+
* `err` {Error}
11111118

11121119
Asynchronous fchmod(2). No arguments other than a possible exception
11131120
are given to the completion callback.
@@ -1136,6 +1143,7 @@ changes:
11361143
* `uid` {integer}
11371144
* `gid` {integer}
11381145
* `callback` {Function}
1146+
* `err` {Error}
11391147

11401148
Asynchronous fchown(2). No arguments other than a possible exception are given
11411149
to the completion callback.
@@ -1163,6 +1171,7 @@ changes:
11631171

11641172
* `fd` {integer}
11651173
* `callback` {Function}
1174+
* `err` {Error}
11661175

11671176
Asynchronous fdatasync(2). No arguments other than a possible exception are
11681177
given to the completion callback.
@@ -1188,6 +1197,8 @@ changes:
11881197

11891198
* `fd` {integer}
11901199
* `callback` {Function}
1200+
* `err` {Error}
1201+
* `stats` {fs.Stats}
11911202

11921203
Asynchronous fstat(2). The callback gets two arguments `(err, stats)` where
11931204
`stats` is an [`fs.Stats`][] object. `fstat()` is identical to [`stat()`][],
@@ -1214,6 +1225,7 @@ changes:
12141225

12151226
* `fd` {integer}
12161227
* `callback` {Function}
1228+
* `err` {Error}
12171229

12181230
Asynchronous fsync(2). No arguments other than a possible exception are given
12191231
to the completion callback.
@@ -1240,6 +1252,7 @@ changes:
12401252
* `fd` {integer}
12411253
* `len` {integer} **Default:** `0`
12421254
* `callback` {Function}
1255+
* `err` {Error}
12431256

12441257
Asynchronous ftruncate(2). No arguments other than a possible exception are
12451258
given to the completion callback.
@@ -1313,6 +1326,7 @@ changes:
13131326
* `atime` {integer}
13141327
* `mtime` {integer}
13151328
* `callback` {Function}
1329+
* `err` {Error}
13161330

13171331
Change the file timestamps of a file referenced by the supplied file
13181332
descriptor.
@@ -1349,6 +1363,7 @@ changes:
13491363
* `path` {string|Buffer}
13501364
* `mode` {integer}
13511365
* `callback` {Function}
1366+
* `err` {Error}
13521367

13531368
Asynchronous lchmod(2). No arguments other than a possible exception
13541369
are given to the completion callback.
@@ -1379,6 +1394,7 @@ changes:
13791394
* `uid` {integer}
13801395
* `gid` {integer}
13811396
* `callback` {Function}
1397+
* `err` {Error}
13821398

13831399
Asynchronous lchown(2). No arguments other than a possible exception are given
13841400
to the completion callback.
@@ -1412,6 +1428,7 @@ changes:
14121428
* `existingPath` {string|Buffer|URL}
14131429
* `newPath` {string|Buffer|URL}
14141430
* `callback` {Function}
1431+
* `err` {Error}
14151432

14161433
Asynchronous link(2). No arguments other than a possible exception are given to
14171434
the completion callback.
@@ -1448,6 +1465,8 @@ changes:
14481465

14491466
* `path` {string|Buffer|URL}
14501467
* `callback` {Function}
1468+
* `err` {Error}
1469+
* `stats` {fs.Stats}
14511470

14521471
Asynchronous lstat(2). The callback gets two arguments `(err, stats)` where
14531472
`stats` is a [`fs.Stats`][] object. `lstat()` is identical to `stat()`,
@@ -1485,6 +1504,7 @@ changes:
14851504
* `path` {string|Buffer|URL}
14861505
* `mode` {integer} **Default:** `0o777`
14871506
* `callback` {Function}
1507+
* `err` {Error}
14881508

14891509
Asynchronous mkdir(2). No arguments other than a possible exception are given
14901510
to the completion callback. `mode` defaults to `0o777`.
@@ -1521,6 +1541,8 @@ changes:
15211541
* `options` {string|Object}
15221542
* `encoding` {string} **Default:** `'utf8'`
15231543
* `callback` {Function}
1544+
* `err` {Error}
1545+
* `folder` {string}
15241546

15251547
Creates a unique temporary directory.
15261548

@@ -1603,6 +1625,8 @@ changes:
16031625
* `flags` {string|number}
16041626
* `mode` {integer} **Default:** `0o666`
16051627
* `callback` {Function}
1628+
* `err` {Error}
1629+
* `fd` {integer}
16061630

16071631
Asynchronous file open. See open(2). `flags` can be:
16081632

@@ -1721,6 +1745,9 @@ changes:
17211745
* `length` {integer}
17221746
* `position` {integer}
17231747
* `callback` {Function}
1748+
* `err` {Error}
1749+
* `bytesRead` {integer}
1750+
* `buffer` {Buffer}
17241751

17251752
Read data from the file specified by `fd`.
17261753

@@ -1761,6 +1788,8 @@ changes:
17611788
* `options` {string|Object}
17621789
* `encoding` {string} **Default:** `'utf8'`
17631790
* `callback` {Function}
1791+
* `err` {Error}
1792+
* `files` {string[]|Buffer[]}
17641793

17651794
Asynchronous readdir(3). Reads the contents of a directory.
17661795
The callback gets two arguments `(err, files)` where `files` is an array of
@@ -1819,6 +1848,8 @@ changes:
18191848
* `encoding` {string|null} **Default:** `null`
18201849
* `flag` {string} **Default:** `'r'`
18211850
* `callback` {Function}
1851+
* `err` {Error}
1852+
* `data` {string|Buffer}
18221853

18231854
Asynchronously reads the entire contents of a file. Example:
18241855

@@ -1914,6 +1945,8 @@ changes:
19141945
* `options` {string|Object}
19151946
* `encoding` {string} **Default:** `'utf8'`
19161947
* `callback` {Function}
1948+
* `err` {Error}
1949+
* `linkString` {string|Buffer}
19171950

19181951
Asynchronous readlink(2). The callback gets two arguments `(err,
19191952
linkString)`.
@@ -1989,6 +2022,8 @@ changes:
19892022
* `options` {string|Object}
19902023
* `encoding` {string} **Default:** `'utf8'`
19912024
* `callback` {Function}
2025+
* `err` {Error}
2026+
* `resolvedPath` {string|Buffer}
19922027

19932028
Asynchronous realpath(3). The `callback` gets two arguments `(err,
19942029
resolvedPath)`. May use `process.cwd` to resolve relative paths.
@@ -2057,6 +2092,7 @@ changes:
20572092
* `oldPath` {string|Buffer|URL}
20582093
* `newPath` {string|Buffer|URL}
20592094
* `callback` {Function}
2095+
* `err` {Error}
20602096

20612097
Asynchronous rename(2). No arguments other than a possible exception are given
20622098
to the completion callback.
@@ -2093,6 +2129,7 @@ changes:
20932129

20942130
* `path` {string|Buffer|URL}
20952131
* `callback` {Function}
2132+
* `err` {Error}
20962133

20972134
Asynchronous rmdir(2). No arguments other than a possible exception are given
20982135
to the completion callback.
@@ -2133,6 +2170,8 @@ changes:
21332170

21342171
* `path` {string|Buffer|URL}
21352172
* `callback` {Function}
2173+
* `err` {Error}
2174+
* `stats` {fs.Stats}
21362175

21372176
Asynchronous stat(2). The callback gets two arguments `(err, stats)` where
21382177
`stats` is an [`fs.Stats`][] object.
@@ -2176,6 +2215,7 @@ changes:
21762215
* `path` {string|Buffer|URL}
21772216
* `type` {string} **Default:** `'file'`
21782217
* `callback` {Function}
2218+
* `err` {Error}
21792219

21802220
Asynchronous symlink(2). No arguments other than a possible exception are given
21812221
to the completion callback. The `type` argument can be set to `'dir'`,
@@ -2222,6 +2262,7 @@ changes:
22222262
* `path` {string|Buffer}
22232263
* `len` {integer} **Default:** `0`
22242264
* `callback` {Function}
2265+
* `err` {Error}
22252266

22262267
Asynchronous truncate(2). No arguments other than a possible exception are
22272268
given to the completion callback. A file descriptor can also be passed as the
@@ -2254,6 +2295,7 @@ changes:
22542295

22552296
* `path` {string|Buffer|URL}
22562297
* `callback` {Function}
2298+
* `err` {Error}
22572299

22582300
Asynchronous unlink(2). No arguments other than a possible exception are given
22592301
to the completion callback.
@@ -2279,6 +2321,8 @@ added: v0.1.31
22792321

22802322
* `filename` {string|Buffer}
22812323
* `listener` {Function|undefined} **Default:** `undefined`
2324+
* `eventType` {string}
2325+
* `filename` {string|Buffer}
22822326

22832327
Stop watching for changes on `filename`. If `listener` is specified, only that
22842328
particular listener is removed. Otherwise, *all* listeners are removed,
@@ -2313,6 +2357,7 @@ changes:
23132357
* `atime` {integer}
23142358
* `mtime` {integer}
23152359
* `callback` {Function}
2360+
* `err` {Error}
23162361

23172362
Change file timestamps of the file referenced by the supplied path.
23182363

@@ -2369,6 +2414,8 @@ changes:
23692414
* `encoding` {string} Specifies the character encoding to be used for the
23702415
filename passed to the listener. **Default:** `'utf8'`
23712416
* `listener` {Function|undefined} **Default:** `undefined`
2417+
* `eventType` {string}
2418+
* `filename` {string|Buffer}
23722419

23732420
Watch for changes on `filename`, where `filename` is either a file or a
23742421
directory. The returned object is a [`fs.FSWatcher`][].
@@ -2471,6 +2518,8 @@ changes:
24712518
* `persistent` {boolean} **Default:** `true`
24722519
* `interval` {integer} **Default:** `5007`
24732520
* `listener` {Function}
2521+
* `current` {fs.Stats}
2522+
* `previous` {fs.Stats}
24742523

24752524
Watch for changes on `filename`. The callback `listener` will be called each
24762525
time the file is accessed.
@@ -2530,6 +2579,9 @@ changes:
25302579
* `length` {integer}
25312580
* `position` {integer}
25322581
* `callback` {Function}
2582+
* `err` {Error}
2583+
* `bytesWritten` {integer}
2584+
* `buffer` {Buffer|Uint8Array}
25332585

25342586
Write `buffer` to the file specified by `fd`.
25352587

@@ -2572,6 +2624,9 @@ changes:
25722624
* `position` {integer}
25732625
* `encoding` {string}
25742626
* `callback` {Function}
2627+
* `err` {Error}
2628+
* `written` {integer}
2629+
* `string` {string}
25752630

25762631
Write `string` to the file specified by `fd`. If `string` is not a string, then
25772632
the value will be coerced to one.
@@ -2621,6 +2676,7 @@ changes:
26212676
* `mode` {integer} **Default:** `0o666`
26222677
* `flag` {string} **Default:** `'w'`
26232678
* `callback` {Function}
2679+
* `err` {Error}
26242680

26252681
Asynchronously writes data to a file, replacing the file if it already exists.
26262682
`data` can be a string or a buffer.

0 commit comments

Comments
 (0)