Skip to content

Commit

Permalink
doc: add missing Returns in fs & util
Browse files Browse the repository at this point in the history
Backport-PR-URL: #19127
PR-URL: #18775
Reviewed-By: Weijia Wang <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
  • Loading branch information
Sho Miyamoto authored and MylesBorins committed Mar 6, 2018
1 parent 4ecf5bb commit e42600f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,7 @@ changes:
* `start` {integer}
* `end` {integer}
* `highWaterMark` {integer}
* Returns: {ReadStream}

Returns a new [`ReadStream`][] object. (See [Readable Streams][]).

Expand Down Expand Up @@ -1273,6 +1274,7 @@ changes:
* `mode` {integer}
* `autoClose` {boolean}
* `start` {integer}
* Returns: {WriteStream}

Returns a new [`WriteStream`][] object. (See [Writable Stream][]).

Expand Down Expand Up @@ -1428,6 +1430,7 @@ changes:
-->

* `path` {string|Buffer|URL}
* Returns: {boolean}

Synchronous version of [`fs.exists()`][].
Returns `true` if the path exists, `false` otherwise.
Expand Down Expand Up @@ -1546,6 +1549,7 @@ added: v0.1.95
-->

* `fd` {integer}
* Returns: {fs.Stats}

Synchronous fstat(2). Returns an instance of [`fs.Stats`][].

Expand Down Expand Up @@ -1820,6 +1824,7 @@ changes:
-->

* `path` {string|Buffer|URL}
* Returns: {fs.Stats}

Synchronous lstat(2). Returns an instance of [`fs.Stats`][].

Expand Down Expand Up @@ -1945,6 +1950,7 @@ added: v5.10.0
* `prefix` {string}
* `options` {string|Object}
* `encoding` {string} **Default:** `'utf8'`
* Returns: {string}

The synchronous version of [`fs.mkdtemp()`][]. Returns the created
folder path.
Expand Down Expand Up @@ -2069,6 +2075,7 @@ changes:
* `path` {string|Buffer|URL}
* `flags` {string|number}
* `mode` {integer} **Default:** `0o666`
* Returns: {number}

Synchronous version of [`fs.open()`][]. Returns an integer representing the file
descriptor.
Expand Down Expand Up @@ -2159,6 +2166,7 @@ changes:
* `path` {string|Buffer|URL}
* `options` {string|Object}
* `encoding` {string} **Default:** `'utf8'`
* Returns: {Array} An array of filenames

Synchronous readdir(3). Returns an array of filenames excluding `'.'` and
`'..'`.
Expand Down Expand Up @@ -2260,6 +2268,7 @@ changes:
* `options` {Object|string}
* `encoding` {string|null} **Default:** `null`
* `flag` {string} **Default:** `'r'`
* Returns: {string|Buffer}

Synchronous version of [`fs.readFile()`][]. Returns the contents of the `path`.

Expand Down Expand Up @@ -2320,6 +2329,7 @@ changes:
* `path` {string|Buffer|URL}
* `options` {string|Object}
* `encoding` {string} **Default:** `'utf8'`
* Returns: {string|Buffer}

Synchronous readlink(2). Returns the symbolic link's string value.

Expand All @@ -2342,6 +2352,7 @@ changes:
* `offset` {integer}
* `length` {integer}
* `position` {integer}
* Returns: {number}

Synchronous version of [`fs.read()`][]. Returns the number of `bytesRead`.

Expand Down Expand Up @@ -2452,6 +2463,7 @@ changes:
* `path` {string|Buffer|URL}
* `options` {string|Object}
* `encoding` {string} **Default:** `'utf8'`
* Returns: {string|Buffer}

Synchronously computes the canonical pathname by resolving `.`, `..` and
symbolic links.
Expand Down Expand Up @@ -2482,6 +2494,7 @@ added: v9.2.0
* `path` {string|Buffer|URL}
* `options` {string|Object}
* `encoding` {string} **Default:** `'utf8'`
* Returns: {string|Buffer}

Synchronous realpath(3).

Expand Down Expand Up @@ -2619,6 +2632,7 @@ changes:
-->

* `path` {string|Buffer|URL}
* Returns: {fs.Stats}

Synchronous stat(2). Returns an instance of [`fs.Stats`][].

Expand Down Expand Up @@ -3197,6 +3211,7 @@ changes:
* `offset` {integer}
* `length` {integer}
* `position` {integer}
* Returns: {number}

## fs.writeSync(fd, string[, position[, encoding]])
<!-- YAML
Expand All @@ -3211,6 +3226,7 @@ changes:
* `string` {string}
* `position` {integer}
* `encoding` {string}
* Returns: {number}

Synchronous versions of [`fs.write()`][]. Returns the number of bytes written.

Expand Down
16 changes: 16 additions & 0 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ contains circular references.
Similar to `util.inspect()` without options.
This will show the full object not including non-enumerable symbols and properties.
* `%%` - single percent sign (`'%'`). This does not consume an argument.
* Returns: {string} The formatted string

If the placeholder does not have a corresponding argument, the placeholder is
not replaced.
Expand Down Expand Up @@ -806,6 +807,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

Internal alias for [`Array.isArray`][].

Expand All @@ -831,6 +833,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`.

Expand All @@ -854,6 +857,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated: Use [`Buffer.isBuffer()`][] instead.
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`.

Expand All @@ -877,6 +881,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`.

Expand All @@ -900,6 +905,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is an [`Error`][]. Otherwise, returns
`false`.
Expand Down Expand Up @@ -939,6 +945,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is a `Function`. Otherwise, returns
`false`.
Expand Down Expand Up @@ -966,6 +973,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is strictly `null`. Otherwise, returns
`false`.
Expand All @@ -990,6 +998,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is `null` or `undefined`. Otherwise,
returns `false`.
Expand All @@ -1014,6 +1023,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`.

Expand All @@ -1039,6 +1049,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is strictly an `Object` **and** not a
`Function`. Otherwise, returns `false`.
Expand All @@ -1065,6 +1076,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is a primitive type. Otherwise, returns
`false`.
Expand Down Expand Up @@ -1101,6 +1113,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`.

Expand All @@ -1124,6 +1137,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is a `string`. Otherwise, returns `false`.

Expand All @@ -1149,6 +1163,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`.

Expand All @@ -1172,6 +1187,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`.

Expand Down

0 comments on commit e42600f

Please sign in to comment.