From 51bb4ace5f63a042527534319cfec2eef7293964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Kraj=C4=8Dovi=C4=8D?= Date: Sun, 18 Jun 2017 20:28:07 +0200 Subject: [PATCH] doc: add default values to functions in fs.md PR-URL: https://github.com/nodejs/node/pull/13767 Refs: https://github.com/nodejs/node/issues/11135 Refs: https://github.com/nodejs/node/pull/13769 Reviewed-By: Gibson Fahnestock Reviewed-By: Colin Ihrig --- doc/api/fs.md | 96 +++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index b3ec1217e96c56..8e6df978af6dd7 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -437,7 +437,7 @@ changes: --> * `path` {string|Buffer|URL} -* `mode` {integer} +* `mode` {integer} **Default:** `fs.constants.F_OK` * `callback` {Function} Tests a user's permissions for the file or directory specified by `path`. @@ -563,7 +563,7 @@ changes: --> * `path` {string|Buffer|URL} -* `mode` {integer} +* `mode` {integer} **Default:** `fs.constants.F_OK` Synchronous version of [`fs.access()`][]. This throws if any accessibility checks fail, and does nothing otherwise. @@ -587,9 +587,9 @@ changes: * `file` {string|Buffer|number} filename or file descriptor * `data` {string|Buffer} * `options` {Object|string} - * `encoding` {string|null} default = `'utf8'` - * `mode` {integer} default = `0o666` - * `flag` {string} default = `'a'` + * `encoding` {string|null} **Default:** `'utf8'` + * `mode` {integer} **Default:** `0o666` + * `flag` {string} **Default:** `'a'` * `callback` {Function} Asynchronously append data to a file, creating the file if it does not yet exist. @@ -630,9 +630,9 @@ changes: * `file` {string|Buffer|number} filename or file descriptor * `data` {string|Buffer} * `options` {Object|string} - * `encoding` {string|null} default = `'utf8'` - * `mode` {integer} default = `0o666` - * `flag` {string} default = `'a'` + * `encoding` {string|null} **Default:** `'utf8'` + * `mode` {integer} **Default:** `0o666` + * `flag` {string} **Default:** `'a'` The synchronous version of [`fs.appendFile()`][]. Returns `undefined`. @@ -1136,7 +1136,7 @@ added: v0.1.96 Synchronous fsync(2). Returns `undefined`. -## fs.ftruncate(fd, len, callback) +## fs.ftruncate(fd[, len], callback) * `fd` {integer} -* `len` {integer} default = `0` +* `len` {integer} **Default:** `0` * `callback` {Function} Asynchronous ftruncate(2). No arguments other than a possible exception are @@ -1194,13 +1194,13 @@ fs.ftruncate(fd, 10, (err) => { The last three bytes are null bytes ('\0'), to compensate the over-truncation. -## fs.ftruncateSync(fd, len) +## fs.ftruncateSync(fd[, len]) * `fd` {integer} -* `len` {integer} default = `0` +* `len` {integer} **Default:** `0` Synchronous ftruncate(2). Returns `undefined`. @@ -1392,7 +1392,7 @@ changes: --> * `path` {string|Buffer|URL} -* `mode` {integer} +* `mode` {integer} **Default:** `0o777` * `callback` {Function} Asynchronous mkdir(2). No arguments other than a possible exception are given @@ -1409,7 +1409,7 @@ changes: --> * `path` {string|Buffer|URL} -* `mode` {integer} +* `mode` {integer} **Default:** `0o777` Synchronous mkdir(2). Returns `undefined`. @@ -1428,7 +1428,7 @@ changes: * `prefix` {string} * `options` {string|Object} - * `encoding` {string} default = `'utf8'` + * `encoding` {string} **Default:** `'utf8'` * `callback` {Function} Creates a unique temporary directory. @@ -1490,7 +1490,7 @@ added: v5.10.0 * `prefix` {string} * `options` {string|Object} - * `encoding` {string} default = `'utf8'` + * `encoding` {string} **Default:** `'utf8'` The synchronous version of [`fs.mkdtemp()`][]. Returns the created folder path. @@ -1510,7 +1510,7 @@ changes: * `path` {string|Buffer|URL} * `flags` {string|number} -* `mode` {integer} +* `mode` {integer} **Default:** `0o666` * `callback` {Function} Asynchronous file open. See open(2). `flags` can be: @@ -1552,7 +1552,7 @@ The file is created if it does not exist. * `'ax+'` - Like `'a+'` but fails if `path` exists. `mode` sets the file mode (permission and sticky bits), but only if the file was -created. It defaults to `0666`, readable and writable. +created. It defaults to `0o666`, readable and writable. The callback gets two arguments `(err, fd)`. @@ -1599,7 +1599,7 @@ changes: * `path` {string|Buffer|URL} * `flags` {string|number} -* `mode` {integer} +* `mode` {integer} **Default:** `0o666` Synchronous version of [`fs.open()`][]. Returns an integer representing the file descriptor. @@ -1658,7 +1658,7 @@ changes: * `path` {string|Buffer|URL} * `options` {string|Object} - * `encoding` {string} default = `'utf8'` + * `encoding` {string} **Default:** `'utf8'` * `callback` {Function} Asynchronous readdir(3). Reads the contents of a directory. @@ -1682,7 +1682,7 @@ changes: * `path` {string|Buffer|URL} * `options` {string|Object} - * `encoding` {string} default = `'utf8'` + * `encoding` {string} **Default:** `'utf8'` Synchronous readdir(3). Returns an array of filenames excluding `'.'` and `'..'`. @@ -1715,8 +1715,8 @@ changes: * `path` {string|Buffer|URL|integer} filename or file descriptor * `options` {Object|string} - * `encoding` {string|null} default = `null` - * `flag` {string} default = `'r'` + * `encoding` {string|null} **Default:** `null` + * `flag` {string} **Default:** `'r'` * `callback` {Function} Asynchronously reads the entire contents of a file. Example: @@ -1775,8 +1775,8 @@ changes: * `path` {string|Buffer|URL|integer} filename or file descriptor * `options` {Object|string} - * `encoding` {string|null} default = `null` - * `flag` {string} default = `'r'` + * `encoding` {string|null} **Default:** `null` + * `flag` {string} **Default:** `'r'` Synchronous version of [`fs.readFile()`][]. Returns the contents of the `path`. @@ -1811,7 +1811,7 @@ changes: * `path` {string|Buffer|URL} * `options` {string|Object} - * `encoding` {string} default = `'utf8'` + * `encoding` {string} **Default:** `'utf8'` * `callback` {Function} Asynchronous readlink(2). The callback gets two arguments `(err, @@ -1834,7 +1834,7 @@ changes: * `path` {string|Buffer|URL} * `options` {string|Object} - * `encoding` {string} default = `'utf8'` + * `encoding` {string} **Default:** `'utf8'` Synchronous readlink(2). Returns the symbolic link's string value. @@ -1886,7 +1886,7 @@ changes: * `path` {string|Buffer|URL} * `options` {string|Object} - * `encoding` {string} default = `'utf8'` + * `encoding` {string} **Default:** `'utf8'` * `callback` {Function} Asynchronous realpath(3). The `callback` gets two arguments `(err, @@ -1924,7 +1924,7 @@ changes: * `path` {string|Buffer|URL} * `options` {string|Object} - * `encoding` {string} default = `'utf8'` + * `encoding` {string} **Default:** `'utf8'` Synchronous realpath(3). Returns the resolved path. @@ -2067,7 +2067,7 @@ changes: * `target` {string|Buffer|URL} * `path` {string|Buffer|URL} -* `type` {string} +* `type` {string} **Default:** `'file'` * `callback` {Function} Asynchronous symlink(2). No arguments other than a possible exception are given @@ -2098,11 +2098,11 @@ changes: * `target` {string|Buffer|URL} * `path` {string|Buffer|URL} -* `type` {string} +* `type` {string} **Default:** `'file'` Synchronous symlink(2). Returns `undefined`. -## fs.truncate(path, len, callback) +## fs.truncate(path[, len], callback) * `path` {string|Buffer} -* `len` {integer} default = `0` +* `len` {integer} **Default:** `0` * `callback` {Function} 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 first argument. In this case, `fs.ftruncate()` is called. -## fs.truncateSync(path, len) +## fs.truncateSync(path[, len]) * `path` {string|Buffer} -* `len` {integer} default = `0` +* `len` {integer} **Default:** `0` Synchronous truncate(2). Returns `undefined`. A file descriptor can also be passed as the first argument. In this case, `fs.ftruncateSync()` is called. @@ -2171,7 +2171,7 @@ added: v0.1.31 --> * `filename` {string|Buffer} -* `listener` {Function} +* `listener` {Function|undefined} **Default:** `undefined` Stop watching for changes on `filename`. If `listener` is specified, only that particular listener is removed. Otherwise, *all* listeners are removed, @@ -2254,14 +2254,14 @@ changes: * `filename` {string|Buffer|URL} * `options` {string|Object} * `persistent` {boolean} Indicates whether the process should continue to run - as long as files are being watched. default = `true` + as long as files are being watched. **Default:** `true` * `recursive` {boolean} Indicates whether all subdirectories should be watched, or only the current directory. This applies when a directory is - specified, and only on supported platforms (See [Caveats][]). default = + specified, and only on supported platforms (See [Caveats][]). **Default:** `false` * `encoding` {string} Specifies the character encoding to be used for the - filename passed to the listener. default = `'utf8'` -* `listener` {Function} + filename passed to the listener. **Default:** `'utf8'` +* `listener` {Function|undefined} **Default:** `undefined` Watch for changes on `filename`, where `filename` is either a file or a directory. The returned object is a [`fs.FSWatcher`][]. @@ -2361,8 +2361,8 @@ changes: * `filename` {string|Buffer|URL} * `options` {Object} - * `persistent` {boolean} - * `interval` {integer} + * `persistent` {boolean} **Default:** `true` + * `interval` {integer} **Default:** `5007` * `listener` {Function} Watch for changes on `filename`. The callback `listener` will be called each @@ -2510,9 +2510,9 @@ changes: * `file` {string|Buffer|integer} filename or file descriptor * `data` {string|Buffer|Uint8Array} * `options` {Object|string} - * `encoding` {string|null} default = `'utf8'` - * `mode` {integer} default = `0o666` - * `flag` {string} default = `'w'` + * `encoding` {string|null} **Default:** `'utf8'` + * `mode` {integer} **Default:** `0o666` + * `flag` {string} **Default:** `'w'` * `callback` {Function} Asynchronously writes data to a file, replacing the file if it already exists. @@ -2560,9 +2560,9 @@ changes: * `file` {string|Buffer|integer} filename or file descriptor * `data` {string|Buffer|Uint8Array} * `options` {Object|string} - * `encoding` {string|null} default = `'utf8'` - * `mode` {integer} default = `0o666` - * `flag` {string} default = `'w'` + * `encoding` {string|null} **Default:** `'utf8'` + * `mode` {integer} **Default:** `0o666` + * `flag` {string} **Default:** `'w'` The synchronous version of [`fs.writeFile()`][]. Returns `undefined`.