Skip to content

Commit 95759fb

Browse files
Sho MiyamotoMayaLekova
authored andcommitted
doc: add missing Returns in fs & util
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]>
1 parent 6b836ee commit 95759fb

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

doc/api/fs.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,7 @@ changes:
12071207
* `start` {integer}
12081208
* `end` {integer}
12091209
* `highWaterMark` {integer}
1210+
* Returns: {stream.Readable}
12101211

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

@@ -1282,6 +1283,7 @@ changes:
12821283
* `mode` {integer}
12831284
* `autoClose` {boolean}
12841285
* `start` {integer}
1286+
* Returns: {stream.Writable}
12851287

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

@@ -1439,6 +1441,7 @@ changes:
14391441
-->
14401442

14411443
* `path` {string|Buffer|URL}
1444+
* Returns: {boolean}
14421445

14431446
Synchronous version of [`fs.exists()`][].
14441447
Returns `true` if the path exists, `false` otherwise.
@@ -1557,6 +1560,7 @@ added: v0.1.95
15571560
-->
15581561

15591562
* `fd` {integer}
1563+
* Returns: {fs.Stats}
15601564

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

@@ -1831,6 +1835,7 @@ changes:
18311835
-->
18321836

18331837
* `path` {string|Buffer|URL}
1838+
* Returns: {fs.Stats}
18341839

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

@@ -1956,6 +1961,7 @@ added: v5.10.0
19561961
* `prefix` {string}
19571962
* `options` {string|Object}
19581963
* `encoding` {string} **Default:** `'utf8'`
1964+
* Returns: {string}
19591965

19601966
The synchronous version of [`fs.mkdtemp()`][]. Returns the created
19611967
folder path.
@@ -2080,6 +2086,7 @@ changes:
20802086
* `path` {string|Buffer|URL}
20812087
* `flags` {string|number}
20822088
* `mode` {integer} **Default:** `0o666`
2089+
* Returns: {number}
20832090

20842091
Synchronous version of [`fs.open()`][]. Returns an integer representing the file
20852092
descriptor.
@@ -2170,6 +2177,7 @@ changes:
21702177
* `path` {string|Buffer|URL}
21712178
* `options` {string|Object}
21722179
* `encoding` {string} **Default:** `'utf8'`
2180+
* Returns: {Array} An array of filenames
21732181

21742182
Synchronous readdir(3). Returns an array of filenames excluding `'.'` and
21752183
`'..'`.
@@ -2270,6 +2278,7 @@ changes:
22702278
* `options` {Object|string}
22712279
* `encoding` {string|null} **Default:** `null`
22722280
* `flag` {string} **Default:** `'r'`
2281+
* Returns: {string|Buffer}
22732282

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

@@ -2330,6 +2339,7 @@ changes:
23302339
* `path` {string|Buffer|URL}
23312340
* `options` {string|Object}
23322341
* `encoding` {string} **Default:** `'utf8'`
2342+
* Returns: {string|Buffer}
23332343

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

@@ -2352,6 +2362,7 @@ changes:
23522362
* `offset` {integer}
23532363
* `length` {integer}
23542364
* `position` {integer}
2365+
* Returns: {number}
23552366

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

@@ -2462,6 +2473,7 @@ changes:
24622473
* `path` {string|Buffer|URL}
24632474
* `options` {string|Object}
24642475
* `encoding` {string} **Default:** `'utf8'`
2476+
* Returns: {string|Buffer}
24652477

24662478
Synchronously computes the canonical pathname by resolving `.`, `..` and
24672479
symbolic links.
@@ -2492,6 +2504,7 @@ added: v9.2.0
24922504
* `path` {string|Buffer|URL}
24932505
* `options` {string|Object}
24942506
* `encoding` {string} **Default:** `'utf8'`
2507+
* Returns: {string|Buffer}
24952508

24962509
Synchronous realpath(3).
24972510

@@ -2629,6 +2642,7 @@ changes:
26292642
-->
26302643

26312644
* `path` {string|Buffer|URL}
2645+
* Returns: {fs.Stats}
26322646

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

@@ -3194,6 +3208,7 @@ changes:
31943208
* `offset` {integer}
31953209
* `length` {integer}
31963210
* `position` {integer}
3211+
* Returns: {number}
31973212

31983213
## fs.writeSync(fd, string[, position[, encoding]])
31993214
<!-- YAML
@@ -3208,6 +3223,7 @@ changes:
32083223
* `string` {string}
32093224
* `position` {integer}
32103225
* `encoding` {string}
3226+
* Returns: {number}
32113227

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

doc/api/util.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ contains circular references.
216216
object formatting. Similar to `util.inspect()` without options. This will show
217217
the full object not including non-enumerable properties and proxies.
218218
* `%%` - single percent sign (`'%'`). This does not consume an argument.
219+
* Returns: {string} The formatted string
219220

220221
If the placeholder does not have a corresponding argument, the placeholder is
221222
not replaced.
@@ -397,6 +398,7 @@ changes:
397398
This is useful to minimize the inspection output for large complicated
398399
objects. To make it recurse indefinitely pass `null` or `Infinity`. Defaults
399400
to `Infinity`.
401+
* Returns: {string} The representation of passed object
400402

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

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

@@ -969,6 +972,7 @@ deprecated: v4.0.0
969972
> Stability: 0 - Deprecated
970973
971974
* `object` {any}
975+
* Returns: {boolean}
972976

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

@@ -992,6 +996,7 @@ deprecated: v4.0.0
992996
> Stability: 0 - Deprecated: Use [`Buffer.isBuffer()`][] instead.
993997
994998
* `object` {any}
999+
* Returns: {boolean}
9951000

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

@@ -1015,6 +1020,7 @@ deprecated: v4.0.0
10151020
> Stability: 0 - Deprecated
10161021
10171022
* `object` {any}
1023+
* Returns: {boolean}
10181024

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

@@ -1038,6 +1044,7 @@ deprecated: v4.0.0
10381044
> Stability: 0 - Deprecated
10391045
10401046
* `object` {any}
1047+
* Returns: {boolean}
10411048

10421049
Returns `true` if the given `object` is an [`Error`][]. Otherwise, returns
10431050
`false`.
@@ -1077,6 +1084,7 @@ deprecated: v4.0.0
10771084
> Stability: 0 - Deprecated
10781085
10791086
* `object` {any}
1087+
* Returns: {boolean}
10801088

10811089
Returns `true` if the given `object` is a `Function`. Otherwise, returns
10821090
`false`.
@@ -1104,6 +1112,7 @@ deprecated: v4.0.0
11041112
> Stability: 0 - Deprecated
11051113
11061114
* `object` {any}
1115+
* Returns: {boolean}
11071116

11081117
Returns `true` if the given `object` is strictly `null`. Otherwise, returns
11091118
`false`.
@@ -1128,6 +1137,7 @@ deprecated: v4.0.0
11281137
> Stability: 0 - Deprecated
11291138
11301139
* `object` {any}
1140+
* Returns: {boolean}
11311141

11321142
Returns `true` if the given `object` is `null` or `undefined`. Otherwise,
11331143
returns `false`.
@@ -1152,6 +1162,7 @@ deprecated: v4.0.0
11521162
> Stability: 0 - Deprecated
11531163
11541164
* `object` {any}
1165+
* Returns: {boolean}
11551166

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

@@ -1177,6 +1188,7 @@ deprecated: v4.0.0
11771188
> Stability: 0 - Deprecated
11781189
11791190
* `object` {any}
1191+
* Returns: {boolean}
11801192

11811193
Returns `true` if the given `object` is strictly an `Object` **and** not a
11821194
`Function`. Otherwise, returns `false`.
@@ -1203,6 +1215,7 @@ deprecated: v4.0.0
12031215
> Stability: 0 - Deprecated
12041216
12051217
* `object` {any}
1218+
* Returns: {boolean}
12061219

12071220
Returns `true` if the given `object` is a primitive type. Otherwise, returns
12081221
`false`.
@@ -1239,6 +1252,7 @@ deprecated: v4.0.0
12391252
> Stability: 0 - Deprecated
12401253
12411254
* `object` {any}
1255+
* Returns: {boolean}
12421256

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

@@ -1262,6 +1276,7 @@ deprecated: v4.0.0
12621276
> Stability: 0 - Deprecated
12631277
12641278
* `object` {any}
1279+
* Returns: {boolean}
12651280

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

@@ -1287,6 +1302,7 @@ deprecated: v4.0.0
12871302
> Stability: 0 - Deprecated
12881303
12891304
* `object` {any}
1305+
* Returns: {boolean}
12901306

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

@@ -1310,6 +1326,7 @@ deprecated: v4.0.0
13101326
> Stability: 0 - Deprecated
13111327
13121328
* `object` {any}
1329+
* Returns: {boolean}
13131330

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

0 commit comments

Comments
 (0)