Skip to content

Commit 6e06d0e

Browse files
matejkrajcovicMylesBorins
authored andcommitted
doc: add callback function signatures in fs.md
Backport-PR-URL: #16306 PR-URL: #13424 Refs: #11135 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 252d08a commit 6e06d0e

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

doc/api/fs.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ added: v0.11.15
324324
* `path` {string|Buffer}
325325
* `mode` {integer}
326326
* `callback` {Function}
327+
* `err` {Error}
327328

328329
Tests a user's permissions for the file or directory specified by `path`.
329330
The `mode` argument is an optional integer that specifies the accessibility
@@ -460,6 +461,7 @@ added: v0.6.7
460461
* `mode` {integer} default = `0o666`
461462
* `flag` {string} default = `'a'`
462463
* `callback` {Function}
464+
* `err` {Error}
463465

464466
Asynchronously append data to a file, creating the file if it does not yet exist.
465467
`data` can be a string or a buffer.
@@ -506,6 +508,7 @@ added: v0.1.30
506508
* `path` {string|Buffer}
507509
* `mode` {integer}
508510
* `callback` {Function}
511+
* `err` {Error}
509512

510513
Asynchronous chmod(2). No arguments other than a possible exception are given
511514
to the completion callback.
@@ -529,6 +532,7 @@ added: v0.1.97
529532
* `uid` {integer}
530533
* `gid` {integer}
531534
* `callback` {Function}
535+
* `err` {Error}
532536

533537
Asynchronous chown(2). No arguments other than a possible exception are given
534538
to the completion callback.
@@ -551,6 +555,7 @@ added: v0.0.2
551555

552556
* `fd` {integer}
553557
* `callback` {Function}
558+
* `err` {Error}
554559

555560
Asynchronous close(2). No arguments other than a possible exception are given
556561
to the completion callback.
@@ -688,6 +693,7 @@ deprecated: v1.0.0
688693
689694
* `path` {string|Buffer}
690695
* `callback` {Function}
696+
* `exists` {Boolean}
691697

692698
Test whether or not the given path exists by checking with the file system.
693699
Then call the `callback` argument with either true or false. Example:
@@ -806,6 +812,7 @@ added: v0.4.7
806812
* `fd` {integer}
807813
* `mode` {integer}
808814
* `callback` {Function}
815+
* `err` {Error}
809816

810817
Asynchronous fchmod(2). No arguments other than a possible exception
811818
are given to the completion callback.
@@ -829,6 +836,7 @@ added: v0.4.7
829836
* `uid` {integer}
830837
* `gid` {integer}
831838
* `callback` {Function}
839+
* `err` {Error}
832840

833841
Asynchronous fchown(2). No arguments other than a possible exception are given
834842
to the completion callback.
@@ -851,6 +859,7 @@ added: v0.1.96
851859

852860
* `fd` {integer}
853861
* `callback` {Function}
862+
* `err` {Error}
854863

855864
Asynchronous fdatasync(2). No arguments other than a possible exception are
856865
given to the completion callback.
@@ -871,6 +880,8 @@ added: v0.1.95
871880

872881
* `fd` {integer}
873882
* `callback` {Function}
883+
* `err` {Error}
884+
* `stats` {fs.Stats}
874885

875886
Asynchronous fstat(2). The callback gets two arguments `(err, stats)` where
876887
`stats` is an [`fs.Stats`][] object. `fstat()` is identical to [`stat()`][],
@@ -892,6 +903,7 @@ added: v0.1.96
892903

893904
* `fd` {integer}
894905
* `callback` {Function}
906+
* `err` {Error}
895907

896908
Asynchronous fsync(2). No arguments other than a possible exception are given
897909
to the completion callback.
@@ -913,6 +925,7 @@ added: v0.8.6
913925
* `fd` {integer}
914926
* `len` {integer} default = `0`
915927
* `callback` {Function}
928+
* `err` {Error}
916929

917930
Asynchronous ftruncate(2). No arguments other than a possible exception are
918931
given to the completion callback.
@@ -977,6 +990,7 @@ added: v0.4.2
977990
* `atime` {integer}
978991
* `mtime` {integer}
979992
* `callback` {Function}
993+
* `err` {Error}
980994

981995
Change the file timestamps of a file referenced by the supplied file
982996
descriptor.
@@ -1003,6 +1017,7 @@ deprecated: v0.4.7
10031017
* `path` {string|Buffer}
10041018
* `mode` {integer}
10051019
* `callback` {Function}
1020+
* `err` {Error}
10061021

10071022
Asynchronous lchmod(2). No arguments other than a possible exception
10081023
are given to the completion callback.
@@ -1028,6 +1043,7 @@ deprecated: v0.4.7
10281043
* `uid` {integer}
10291044
* `gid` {integer}
10301045
* `callback` {Function}
1046+
* `err` {Error}
10311047

10321048
Asynchronous lchown(2). No arguments other than a possible exception are given
10331049
to the completion callback.
@@ -1051,6 +1067,7 @@ added: v0.1.31
10511067
* `existingPath` {string|Buffer}
10521068
* `newPath` {string|Buffer}
10531069
* `callback` {Function}
1070+
* `err` {Error}
10541071

10551072
Asynchronous link(2). No arguments other than a possible exception are given to
10561073
the completion callback.
@@ -1072,6 +1089,8 @@ added: v0.1.30
10721089

10731090
* `path` {string|Buffer}
10741091
* `callback` {Function}
1092+
* `err` {Error}
1093+
* `stats` {fs.Stats}
10751094

10761095
Asynchronous lstat(2). The callback gets two arguments `(err, stats)` where
10771096
`stats` is a [`fs.Stats`][] object. `lstat()` is identical to `stat()`,
@@ -1095,6 +1114,7 @@ added: v0.1.8
10951114
* `path` {string|Buffer}
10961115
* `mode` {integer}
10971116
* `callback` {Function}
1117+
* `err` {Error}
10981118

10991119
Asynchronous mkdir(2). No arguments other than a possible exception are given
11001120
to the completion callback. `mode` defaults to `0o777`.
@@ -1118,6 +1138,8 @@ added: v5.10.0
11181138
* `options` {string|Object}
11191139
* `encoding` {string} default = `'utf8'`
11201140
* `callback` {Function}
1141+
* `err` {Error}
1142+
* `folder` {string}
11211143

11221144
Creates a unique temporary directory.
11231145

@@ -1195,6 +1217,8 @@ added: v0.0.2
11951217
* `flags` {string|number}
11961218
* `mode` {integer}
11971219
* `callback` {Function}
1220+
* `err` {Error}
1221+
* `fd` {integer}
11981222

11991223
Asynchronous file open. See open(2). `flags` can be:
12001224

@@ -1301,6 +1325,9 @@ added: v0.0.2
13011325
* `length` {integer}
13021326
* `position` {integer}
13031327
* `callback` {Function}
1328+
* `err` {Error}
1329+
* `bytesRead` {integer}
1330+
* `buffer` {Buffer}
13041331

13051332
Read data from the file specified by `fd`.
13061333

@@ -1326,6 +1353,8 @@ added: v0.1.8
13261353
* `options` {string|Object}
13271354
* `encoding` {string} default = `'utf8'`
13281355
* `callback` {Function}
1356+
* `err` {Error}
1357+
* `files` {string[]|Buffer[]}
13291358

13301359
Asynchronous readdir(3). Reads the contents of a directory.
13311360
The callback gets two arguments `(err, files)` where `files` is an array of
@@ -1363,6 +1392,8 @@ added: v0.1.29
13631392
* `encoding` {string|null} default = `null`
13641393
* `flag` {string} default = `'r'`
13651394
* `callback` {Function}
1395+
* `err` {Error}
1396+
* `data` {string|Buffer}
13661397

13671398
Asynchronously reads the entire contents of a file. Example:
13681399

@@ -1441,6 +1472,8 @@ added: v0.1.31
14411472
* `options` {string|Object}
14421473
* `encoding` {string} default = `'utf8'`
14431474
* `callback` {Function}
1475+
* `err` {Error}
1476+
* `linkString` {string|Buffer}
14441477

14451478
Asynchronous readlink(2). The callback gets two arguments `(err,
14461479
linkString)`.
@@ -1488,6 +1521,8 @@ added: v0.1.31
14881521
* `options` {string|Object}
14891522
* `encoding` {string} default = `'utf8'`
14901523
* `callback` {Function}
1524+
* `err` {Error}
1525+
* `resolvedPath` {string|Buffer}
14911526

14921527
Asynchronous realpath(3). The `callback` gets two arguments `(err,
14931528
resolvedPath)`. May use `process.cwd` to resolve relative paths.
@@ -1525,6 +1560,7 @@ added: v0.0.2
15251560
* `oldPath` {string|Buffer}
15261561
* `newPath` {string|Buffer}
15271562
* `callback` {Function}
1563+
* `err` {Error}
15281564

15291565
Asynchronous rename(2). No arguments other than a possible exception are given
15301566
to the completion callback.
@@ -1546,6 +1582,7 @@ added: v0.0.2
15461582

15471583
* `path` {string|Buffer}
15481584
* `callback` {Function}
1585+
* `err` {Error}
15491586

15501587
Asynchronous rmdir(2). No arguments other than a possible exception are given
15511588
to the completion callback.
@@ -1572,6 +1609,8 @@ added: v0.0.2
15721609

15731610
* `path` {string|Buffer}
15741611
* `callback` {Function}
1612+
* `err` {Error}
1613+
* `stats` {fs.Stats}
15751614

15761615
Asynchronous stat(2). The callback gets two arguments `(err, stats)` where
15771616
`stats` is an [`fs.Stats`][] object.
@@ -1604,6 +1643,7 @@ added: v0.1.31
16041643
* `path` {string|Buffer}
16051644
* `type` {string}
16061645
* `callback` {Function}
1646+
* `err` {Error}
16071647

16081648
Asynchronous symlink(2). No arguments other than a possible exception are given
16091649
to the completion callback. The `type` argument can be set to `'dir'`,
@@ -1639,6 +1679,7 @@ added: v0.8.6
16391679
* `path` {string|Buffer}
16401680
* `len` {integer} default = `0`
16411681
* `callback` {Function}
1682+
* `err` {Error}
16421683

16431684
Asynchronous truncate(2). No arguments other than a possible exception are
16441685
given to the completion callback. A file descriptor can also be passed as the
@@ -1662,6 +1703,7 @@ added: v0.0.2
16621703

16631704
* `path` {string|Buffer}
16641705
* `callback` {Function}
1706+
* `err` {Error}
16651707

16661708
Asynchronous unlink(2). No arguments other than a possible exception are given
16671709
to the completion callback.
@@ -1682,6 +1724,8 @@ added: v0.1.31
16821724

16831725
* `filename` {string|Buffer}
16841726
* `listener` {Function}
1727+
* `eventType` {string}
1728+
* `filename` {string|Buffer}
16851729

16861730
Stop watching for changes on `filename`. If `listener` is specified, only that
16871731
particular listener is removed. Otherwise, *all* listeners are removed and you
@@ -1703,6 +1747,7 @@ added: v0.4.2
17031747
* `atime` {integer}
17041748
* `mtime` {integer}
17051749
* `callback` {Function}
1750+
* `err` {Error}
17061751

17071752
Change file timestamps of the file referenced by the supplied path.
17081753

@@ -1743,6 +1788,8 @@ added: v0.5.10
17431788
* `encoding` {string} Specifies the character encoding to be used for the
17441789
filename passed to the listener. default = `'utf8'`
17451790
* `listener` {Function}
1791+
* `eventType` {string}
1792+
* `filename` {string|Buffer}
17461793

17471794
Watch for changes on `filename`, where `filename` is either a file or a
17481795
directory. The returned object is a [`fs.FSWatcher`][].
@@ -1840,6 +1887,8 @@ added: v0.1.31
18401887
* `persistent` {boolean}
18411888
* `interval` {integer}
18421889
* `listener` {Function}
1890+
* `current` {fs.Stats}
1891+
* `previous` {fs.Stats}
18431892

18441893
Watch for changes on `filename`. The callback `listener` will be called each
18451894
time the file is accessed.
@@ -1887,6 +1936,9 @@ added: v0.0.2
18871936
* `length` {integer}
18881937
* `position` {integer}
18891938
* `callback` {Function}
1939+
* `err` {Error}
1940+
* `bytesWritten` {integer}
1941+
* `buffer` {Buffer|Uint8Array}
18901942

18911943
Write `buffer` to the file specified by `fd`.
18921944

@@ -1918,6 +1970,9 @@ added: v0.11.5
19181970
* `position` {integer}
19191971
* `encoding` {string}
19201972
* `callback` {Function}
1973+
* `err` {Error}
1974+
* `written` {integer}
1975+
* `string` {string}
19211976

19221977
Write `string` to the file specified by `fd`. If `string` is not a string, then
19231978
the value will be coerced to one.
@@ -1956,6 +2011,7 @@ added: v0.1.29
19562011
* `mode` {integer} default = `0o666`
19572012
* `flag` {string} default = `'w'`
19582013
* `callback` {Function}
2014+
* `err` {Error}
19592015

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

0 commit comments

Comments
 (0)