Skip to content

Commit

Permalink
doc: add default values to functions in fs.md
Browse files Browse the repository at this point in the history
PR-URL: nodejs#13767
Refs: nodejs#11135
Refs: nodejs#13769
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
matejkrajcovic authored and addaleax committed Jul 3, 2017
1 parent 0063a53 commit 2c13e6f
Showing 1 changed file with 48 additions and 48 deletions.
96 changes: 48 additions & 48 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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`.

Expand Down Expand Up @@ -1136,7 +1136,7 @@ added: v0.1.96

Synchronous fsync(2). Returns `undefined`.

## fs.ftruncate(fd, len, callback)
## fs.ftruncate(fd[, len], callback)
<!-- YAML
added: v0.8.6
changes:
Expand All @@ -1147,7 +1147,7 @@ changes:
-->

* `fd` {integer}
* `len` {integer} default = `0`
* `len` {integer} **Default:** `0`
* `callback` {Function}

Asynchronous ftruncate(2). No arguments other than a possible exception are
Expand Down Expand Up @@ -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])
<!-- YAML
added: v0.8.6
-->

* `fd` {integer}
* `len` {integer} default = `0`
* `len` {integer} **Default:** `0`

Synchronous ftruncate(2). Returns `undefined`.

Expand Down Expand Up @@ -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
Expand All @@ -1409,7 +1409,7 @@ changes:
-->

* `path` {string|Buffer|URL}
* `mode` {integer}
* `mode` {integer} **Default:** `0o777`

Synchronous mkdir(2). Returns `undefined`.

Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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:
Expand Down Expand Up @@ -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)`.

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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
`'..'`.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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`.

Expand Down Expand Up @@ -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,
Expand All @@ -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.

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
<!-- YAML
added: v0.8.6
changes:
Expand All @@ -2113,20 +2113,20 @@ changes:
-->

* `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])
<!-- YAML
added: v0.8.6
-->

* `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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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`][].
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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`.

Expand Down

0 comments on commit 2c13e6f

Please sign in to comment.