doc: add callback function signatures in fs.md

PR-URL: https://github.com/nodejs/node/pull/13424
Refs: https://github.com/nodejs/node/issues/11135
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Matej Krajčovič authored and Myles Borins committed 2017-10-03 14:03:19 -07:00
1 parent be4e809af2
commit 6565ddabd0
1 file changed
+56
+56
View File
@@ -448,6 +448,7 @@ changes:
* `path` {string|Buffer|URL}
* `mode` {integer} **Default:** `fs.constants.F_OK`
* `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
@@ -600,6 +601,7 @@ changes:
* `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.
@@ -662,6 +664,7 @@ changes:
* `path` {string|Buffer|URL}
* `mode` {integer}
* `callback` {Function}
* `err` {Error}
Asynchronous chmod(2). No arguments other than a possible exception are given
to the completion callback.
@@ -699,6 +702,7 @@ changes:
* `uid` {integer}
* `gid` {integer}
* `callback` {Function}
* `err` {Error}
Asynchronous chown(2). No arguments other than a possible exception are given
to the completion callback.
@@ -731,6 +735,7 @@ changes:
* `fd` {integer}
* `callback` {Function}
* `err` {Error}
Asynchronous close(2). No arguments other than a possible exception are given
to the completion callback.
@@ -980,6 +985,7 @@ deprecated: v1.0.0
* `path` {string|Buffer|URL}
* `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:
@@ -1108,6 +1114,7 @@ changes:
* `fd` {integer}
* `mode` {integer}
* `callback` {Function}
* `err` {Error}
Asynchronous fchmod(2). No arguments other than a possible exception
are given to the completion callback.
@@ -1136,6 +1143,7 @@ changes:
* `uid` {integer}
* `gid` {integer}
* `callback` {Function}
* `err` {Error}
Asynchronous fchown(2). No arguments other than a possible exception are given
to the completion callback.
@@ -1163,6 +1171,7 @@ changes:
* `fd` {integer}
* `callback` {Function}
* `err` {Error}
Asynchronous fdatasync(2). No arguments other than a possible exception are
given to the completion callback.
@@ -1188,6 +1197,8 @@ changes:
* `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()`][],
@@ -1214,6 +1225,7 @@ changes:
* `fd` {integer}
* `callback` {Function}
* `err` {Error}
Asynchronous fsync(2). No arguments other than a possible exception are given
to the completion callback.
@@ -1240,6 +1252,7 @@ changes:
* `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.
@@ -1313,6 +1326,7 @@ changes:
* `atime` {integer}
* `mtime` {integer}
* `callback` {Function}
* `err` {Error}
Change the file timestamps of a file referenced by the supplied file
descriptor.
@@ -1349,6 +1363,7 @@ changes:
* `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.
@@ -1379,6 +1394,7 @@ changes:
* `uid` {integer}
* `gid` {integer}
* `callback` {Function}
* `err` {Error}
Asynchronous lchown(2). No arguments other than a possible exception are given
to the completion callback.
@@ -1412,6 +1428,7 @@ changes:
* `existingPath` {string|Buffer|URL}
* `newPath` {string|Buffer|URL}
* `callback` {Function}
* `err` {Error}
Asynchronous link(2). No arguments other than a possible exception are given to
the completion callback.
@@ -1448,6 +1465,8 @@ changes:
* `path` {string|Buffer|URL}
* `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()`,
@@ -1485,6 +1504,7 @@ changes:
* `path` {string|Buffer|URL}
* `mode` {integer} **Default:** `0o777`
* `callback` {Function}
* `err` {Error}
Asynchronous mkdir(2). No arguments other than a possible exception are given
to the completion callback. `mode` defaults to `0o777`.
@@ -1521,6 +1541,8 @@ changes:
* `options` {string|Object}
* `encoding` {string} **Default:** `'utf8'`
* `callback` {Function}
* `err` {Error}
* `folder` {string}
Creates a unique temporary directory.
@@ -1603,6 +1625,8 @@ changes:
* `flags` {string|number}
* `mode` {integer} **Default:** `0o666`
* `callback` {Function}
* `err` {Error}
* `fd` {integer}
Asynchronous file open. See open(2). `flags` can be:
@@ -1721,6 +1745,9 @@ changes:
* `length` {integer}
* `position` {integer}
* `callback` {Function}
* `err` {Error}
* `bytesRead` {integer}
* `buffer` {Buffer}
Read data from the file specified by `fd`.
@@ -1761,6 +1788,8 @@ changes:
* `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
@@ -1819,6 +1848,8 @@ changes:
* `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:
@@ -1914,6 +1945,8 @@ changes:
* `options` {string|Object}
* `encoding` {string} **Default:** `'utf8'`
* `callback` {Function}
* `err` {Error}
* `linkString` {string|Buffer}
Asynchronous readlink(2). The callback gets two arguments `(err,
linkString)`.
@@ -1989,6 +2022,8 @@ changes:
* `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.
@@ -2057,6 +2092,7 @@ changes:
* `oldPath` {string|Buffer|URL}
* `newPath` {string|Buffer|URL}
* `callback` {Function}
* `err` {Error}
Asynchronous rename(2). No arguments other than a possible exception are given
to the completion callback.
@@ -2093,6 +2129,7 @@ changes:
* `path` {string|Buffer|URL}
* `callback` {Function}
* `err` {Error}
Asynchronous rmdir(2). No arguments other than a possible exception are given
to the completion callback.
@@ -2133,6 +2170,8 @@ changes:
* `path` {string|Buffer|URL}
* `callback` {Function}
* `err` {Error}
* `stats` {fs.Stats}
Asynchronous stat(2). The callback gets two arguments `(err, stats)` where
`stats` is an [`fs.Stats`][] object.
@@ -2176,6 +2215,7 @@ changes:
* `path` {string|Buffer|URL}
* `type` {string} **Default:** `'file'`
* `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'`,
@@ -2222,6 +2262,7 @@ changes:
* `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
@@ -2254,6 +2295,7 @@ changes:
* `path` {string|Buffer|URL}
* `callback` {Function}
* `err` {Error}
Asynchronous unlink(2). No arguments other than a possible exception are given
to the completion callback.
@@ -2279,6 +2321,8 @@ added: v0.1.31
* `filename` {string|Buffer}
* `listener` {Function|undefined} **Default:** `undefined`
* `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,
@@ -2313,6 +2357,7 @@ changes:
* `atime` {integer}
* `mtime` {integer}
* `callback` {Function}
* `err` {Error}
Change file timestamps of the file referenced by the supplied path.
@@ -2369,6 +2414,8 @@ changes:
* `encoding` {string} Specifies the character encoding to be used for the
filename passed to the listener. **Default:** `'utf8'`
* `listener` {Function|undefined} **Default:** `undefined`
* `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`][].
@@ -2471,6 +2518,8 @@ changes:
* `persistent` {boolean} **Default:** `true`
* `interval` {integer} **Default:** `5007`
* `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.
@@ -2530,6 +2579,9 @@ changes:
* `length` {integer}
* `position` {integer}
* `callback` {Function}
* `err` {Error}
* `bytesWritten` {integer}
* `buffer` {Buffer|Uint8Array}
Write `buffer` to the file specified by `fd`.
@@ -2572,6 +2624,9 @@ changes:
* `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.
@@ -2621,6 +2676,7 @@ changes:
* `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.