Skip to content

Commit

Permalink
doc: add callback function signatures in fs.md
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
matejkrajcovic authored and MylesBorins committed Oct 19, 2017
1 parent 72f2646 commit 5cf6f16
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ added: v0.11.15
* `path` {string|Buffer}
* `mode` {integer}
* `callback` {Function}
* `err` {Error}

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

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

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

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

* `fd` {integer}
* `callback` {Function}
* `err` {Error}

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

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

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

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

* `fd` {integer}
* `callback` {Function}
* `err` {Error}

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

* `fd` {integer}
* `callback` {Function}
* `err` {Error}
* `stats` {fs.Stats}

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

* `fd` {integer}
* `callback` {Function}
* `err` {Error}

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

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

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

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

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

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

* `path` {string|Buffer}
* `callback` {Function}
* `err` {Error}
* `stats` {fs.Stats}

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

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

Creates a unique temporary directory.

Expand Down Expand Up @@ -1195,6 +1217,8 @@ added: v0.0.2
* `flags` {string|number}
* `mode` {integer}
* `callback` {Function}
* `err` {Error}
* `fd` {integer}

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

Expand Down Expand Up @@ -1301,6 +1325,9 @@ added: v0.0.2
* `length` {integer}
* `position` {integer}
* `callback` {Function}
* `err` {Error}
* `bytesRead` {integer}
* `buffer` {Buffer}

Read data from the file specified by `fd`.

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

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

Asynchronously reads the entire contents of a file. Example:

Expand Down Expand Up @@ -1441,6 +1472,8 @@ added: v0.1.31
* `options` {string|Object}
* `encoding` {string} default = `'utf8'`
* `callback` {Function}
* `err` {Error}
* `linkString` {string|Buffer}

Asynchronous readlink(2). The callback gets two arguments `(err,
linkString)`.
Expand Down Expand Up @@ -1488,6 +1521,8 @@ added: v0.1.31
* `options` {string|Object}
* `encoding` {string} default = `'utf8'`
* `callback` {Function}
* `err` {Error}
* `resolvedPath` {string|Buffer}

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

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

* `path` {string|Buffer}
* `callback` {Function}
* `err` {Error}

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

* `path` {string|Buffer}
* `callback` {Function}
* `err` {Error}
* `stats` {fs.Stats}

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

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

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

* `path` {string|Buffer}
* `callback` {Function}
* `err` {Error}

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

* `filename` {string|Buffer}
* `listener` {Function}
* `eventType` {string}
* `filename` {string|Buffer}

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

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

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

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

Watch for changes on `filename`. The callback `listener` will be called each
time the file is accessed.
Expand Down Expand Up @@ -1887,6 +1936,9 @@ added: v0.0.2
* `length` {integer}
* `position` {integer}
* `callback` {Function}
* `err` {Error}
* `bytesWritten` {integer}
* `buffer` {Buffer|Uint8Array}

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

Expand Down Expand Up @@ -1918,6 +1970,9 @@ added: v0.11.5
* `position` {integer}
* `encoding` {string}
* `callback` {Function}
* `err` {Error}
* `written` {integer}
* `string` {string}

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

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

0 comments on commit 5cf6f16

Please sign in to comment.