Skip to content

Commit

Permalink
doc: add missing Returns in fs & util
Browse files Browse the repository at this point in the history
PR-URL: nodejs#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 BridgeAR committed Feb 16, 2018
1 parent ff471da commit 9a18b0e
Show file tree
Hide file tree
Showing 2 changed files with 33 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 @@ -1207,6 +1207,7 @@ changes:
* `start` {integer}
* `end` {integer}
* `highWaterMark` {integer}
* Returns: {stream.Readable}

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

Expand Down Expand Up @@ -1282,6 +1283,7 @@ changes:
* `mode` {integer}
* `autoClose` {boolean}
* `start` {integer}
* Returns: {stream.Writable}

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

Expand Down Expand Up @@ -1439,6 +1441,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 @@ -1557,6 +1560,7 @@ added: v0.1.95
-->

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

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

Expand Down Expand Up @@ -1831,6 +1835,7 @@ changes:
-->

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

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

Expand Down Expand Up @@ -1956,6 +1961,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 @@ -2080,6 +2086,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 @@ -2170,6 +2177,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 @@ -2270,6 +2278,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 @@ -2330,6 +2339,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 @@ -2352,6 +2362,7 @@ changes:
* `offset` {integer}
* `length` {integer}
* `position` {integer}
* Returns: {number}

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

Expand Down Expand Up @@ -2462,6 +2473,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 @@ -2492,6 +2504,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 @@ -2629,6 +2642,7 @@ changes:
-->

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

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

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

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

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

Expand Down
17 changes: 17 additions & 0 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ contains circular references.
object formatting. Similar to `util.inspect()` without options. This will show
the full object not including non-enumerable properties and proxies.
* `%%` - 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 @@ -397,6 +398,7 @@ changes:
This is useful to minimize the inspection output for large complicated
objects. To make it recurse indefinitely pass `null` or `Infinity`. Defaults
to `Infinity`.
* Returns: {string} The representation of passed object

The `util.inspect()` method returns a string representation of `object` that is
intended for debugging. The output of `util.inspect` may change at any time
Expand Down Expand Up @@ -944,6 +946,7 @@ deprecated: v4.0.0
> Stability: 0 - Deprecated
* `object` {any}
* Returns: {boolean}

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

Expand All @@ -969,6 +972,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 @@ -992,6 +996,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 @@ -1015,6 +1020,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 @@ -1038,6 +1044,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 @@ -1077,6 +1084,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 @@ -1104,6 +1112,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 @@ -1128,6 +1137,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 @@ -1152,6 +1162,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 @@ -1177,6 +1188,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 @@ -1203,6 +1215,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 @@ -1239,6 +1252,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 @@ -1262,6 +1276,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 @@ -1287,6 +1302,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 @@ -1310,6 +1326,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 9a18b0e

Please sign in to comment.