Skip to content

Commit 310040c

Browse files
matejkrajcovicaddaleax
authored andcommitted
doc: add default values to functions in fs.md
PR-URL: #13767 Refs: #11135 Refs: #13769 Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 50ee4bd commit 310040c

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

doc/api/fs.md

+48-48
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ changes:
437437
-->
438438

439439
* `path` {string|Buffer|URL}
440-
* `mode` {integer}
440+
* `mode` {integer} **Default:** `fs.constants.F_OK`
441441
* `callback` {Function}
442442

443443
Tests a user's permissions for the file or directory specified by `path`.
@@ -563,7 +563,7 @@ changes:
563563
-->
564564

565565
* `path` {string|Buffer|URL}
566-
* `mode` {integer}
566+
* `mode` {integer} **Default:** `fs.constants.F_OK`
567567

568568
Synchronous version of [`fs.access()`][]. This throws if any accessibility
569569
checks fail, and does nothing otherwise.
@@ -587,9 +587,9 @@ changes:
587587
* `file` {string|Buffer|number} filename or file descriptor
588588
* `data` {string|Buffer}
589589
* `options` {Object|string}
590-
* `encoding` {string|null} default = `'utf8'`
591-
* `mode` {integer} default = `0o666`
592-
* `flag` {string} default = `'a'`
590+
* `encoding` {string|null} **Default:** `'utf8'`
591+
* `mode` {integer} **Default:** `0o666`
592+
* `flag` {string} **Default:** `'a'`
593593
* `callback` {Function}
594594

595595
Asynchronously append data to a file, creating the file if it does not yet exist.
@@ -630,9 +630,9 @@ changes:
630630
* `file` {string|Buffer|number} filename or file descriptor
631631
* `data` {string|Buffer}
632632
* `options` {Object|string}
633-
* `encoding` {string|null} default = `'utf8'`
634-
* `mode` {integer} default = `0o666`
635-
* `flag` {string} default = `'a'`
633+
* `encoding` {string|null} **Default:** `'utf8'`
634+
* `mode` {integer} **Default:** `0o666`
635+
* `flag` {string} **Default:** `'a'`
636636

637637
The synchronous version of [`fs.appendFile()`][]. Returns `undefined`.
638638

@@ -1136,7 +1136,7 @@ added: v0.1.96
11361136

11371137
Synchronous fsync(2). Returns `undefined`.
11381138

1139-
## fs.ftruncate(fd, len, callback)
1139+
## fs.ftruncate(fd[, len], callback)
11401140
<!-- YAML
11411141
added: v0.8.6
11421142
changes:
@@ -1147,7 +1147,7 @@ changes:
11471147
-->
11481148

11491149
* `fd` {integer}
1150-
* `len` {integer} default = `0`
1150+
* `len` {integer} **Default:** `0`
11511151
* `callback` {Function}
11521152

11531153
Asynchronous ftruncate(2). No arguments other than a possible exception are
@@ -1194,13 +1194,13 @@ fs.ftruncate(fd, 10, (err) => {
11941194

11951195
The last three bytes are null bytes ('\0'), to compensate the over-truncation.
11961196

1197-
## fs.ftruncateSync(fd, len)
1197+
## fs.ftruncateSync(fd[, len])
11981198
<!-- YAML
11991199
added: v0.8.6
12001200
-->
12011201

12021202
* `fd` {integer}
1203-
* `len` {integer} default = `0`
1203+
* `len` {integer} **Default:** `0`
12041204

12051205
Synchronous ftruncate(2). Returns `undefined`.
12061206

@@ -1392,7 +1392,7 @@ changes:
13921392
-->
13931393

13941394
* `path` {string|Buffer|URL}
1395-
* `mode` {integer}
1395+
* `mode` {integer} **Default:** `0o777`
13961396
* `callback` {Function}
13971397

13981398
Asynchronous mkdir(2). No arguments other than a possible exception are given
@@ -1409,7 +1409,7 @@ changes:
14091409
-->
14101410

14111411
* `path` {string|Buffer|URL}
1412-
* `mode` {integer}
1412+
* `mode` {integer} **Default:** `0o777`
14131413

14141414
Synchronous mkdir(2). Returns `undefined`.
14151415

@@ -1428,7 +1428,7 @@ changes:
14281428

14291429
* `prefix` {string}
14301430
* `options` {string|Object}
1431-
* `encoding` {string} default = `'utf8'`
1431+
* `encoding` {string} **Default:** `'utf8'`
14321432
* `callback` {Function}
14331433

14341434
Creates a unique temporary directory.
@@ -1490,7 +1490,7 @@ added: v5.10.0
14901490

14911491
* `prefix` {string}
14921492
* `options` {string|Object}
1493-
* `encoding` {string} default = `'utf8'`
1493+
* `encoding` {string} **Default:** `'utf8'`
14941494

14951495
The synchronous version of [`fs.mkdtemp()`][]. Returns the created
14961496
folder path.
@@ -1510,7 +1510,7 @@ changes:
15101510

15111511
* `path` {string|Buffer|URL}
15121512
* `flags` {string|number}
1513-
* `mode` {integer}
1513+
* `mode` {integer} **Default:** `0o666`
15141514
* `callback` {Function}
15151515

15161516
Asynchronous file open. See open(2). `flags` can be:
@@ -1552,7 +1552,7 @@ The file is created if it does not exist.
15521552
* `'ax+'` - Like `'a+'` but fails if `path` exists.
15531553

15541554
`mode` sets the file mode (permission and sticky bits), but only if the file was
1555-
created. It defaults to `0666`, readable and writable.
1555+
created. It defaults to `0o666`, readable and writable.
15561556

15571557
The callback gets two arguments `(err, fd)`.
15581558

@@ -1599,7 +1599,7 @@ changes:
15991599

16001600
* `path` {string|Buffer|URL}
16011601
* `flags` {string|number}
1602-
* `mode` {integer}
1602+
* `mode` {integer} **Default:** `0o666`
16031603

16041604
Synchronous version of [`fs.open()`][]. Returns an integer representing the file
16051605
descriptor.
@@ -1658,7 +1658,7 @@ changes:
16581658

16591659
* `path` {string|Buffer|URL}
16601660
* `options` {string|Object}
1661-
* `encoding` {string} default = `'utf8'`
1661+
* `encoding` {string} **Default:** `'utf8'`
16621662
* `callback` {Function}
16631663

16641664
Asynchronous readdir(3). Reads the contents of a directory.
@@ -1682,7 +1682,7 @@ changes:
16821682

16831683
* `path` {string|Buffer|URL}
16841684
* `options` {string|Object}
1685-
* `encoding` {string} default = `'utf8'`
1685+
* `encoding` {string} **Default:** `'utf8'`
16861686

16871687
Synchronous readdir(3). Returns an array of filenames excluding `'.'` and
16881688
`'..'`.
@@ -1715,8 +1715,8 @@ changes:
17151715

17161716
* `path` {string|Buffer|URL|integer} filename or file descriptor
17171717
* `options` {Object|string}
1718-
* `encoding` {string|null} default = `null`
1719-
* `flag` {string} default = `'r'`
1718+
* `encoding` {string|null} **Default:** `null`
1719+
* `flag` {string} **Default:** `'r'`
17201720
* `callback` {Function}
17211721

17221722
Asynchronously reads the entire contents of a file. Example:
@@ -1775,8 +1775,8 @@ changes:
17751775

17761776
* `path` {string|Buffer|URL|integer} filename or file descriptor
17771777
* `options` {Object|string}
1778-
* `encoding` {string|null} default = `null`
1779-
* `flag` {string} default = `'r'`
1778+
* `encoding` {string|null} **Default:** `null`
1779+
* `flag` {string} **Default:** `'r'`
17801780

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

@@ -1811,7 +1811,7 @@ changes:
18111811

18121812
* `path` {string|Buffer|URL}
18131813
* `options` {string|Object}
1814-
* `encoding` {string} default = `'utf8'`
1814+
* `encoding` {string} **Default:** `'utf8'`
18151815
* `callback` {Function}
18161816

18171817
Asynchronous readlink(2). The callback gets two arguments `(err,
@@ -1834,7 +1834,7 @@ changes:
18341834

18351835
* `path` {string|Buffer|URL}
18361836
* `options` {string|Object}
1837-
* `encoding` {string} default = `'utf8'`
1837+
* `encoding` {string} **Default:** `'utf8'`
18381838

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

@@ -1886,7 +1886,7 @@ changes:
18861886

18871887
* `path` {string|Buffer|URL}
18881888
* `options` {string|Object}
1889-
* `encoding` {string} default = `'utf8'`
1889+
* `encoding` {string} **Default:** `'utf8'`
18901890
* `callback` {Function}
18911891

18921892
Asynchronous realpath(3). The `callback` gets two arguments `(err,
@@ -1924,7 +1924,7 @@ changes:
19241924

19251925
* `path` {string|Buffer|URL}
19261926
* `options` {string|Object}
1927-
* `encoding` {string} default = `'utf8'`
1927+
* `encoding` {string} **Default:** `'utf8'`
19281928

19291929
Synchronous realpath(3). Returns the resolved path.
19301930

@@ -2067,7 +2067,7 @@ changes:
20672067

20682068
* `target` {string|Buffer|URL}
20692069
* `path` {string|Buffer|URL}
2070-
* `type` {string}
2070+
* `type` {string} **Default:** `'file'`
20712071
* `callback` {Function}
20722072

20732073
Asynchronous symlink(2). No arguments other than a possible exception are given
@@ -2098,11 +2098,11 @@ changes:
20982098

20992099
* `target` {string|Buffer|URL}
21002100
* `path` {string|Buffer|URL}
2101-
* `type` {string}
2101+
* `type` {string} **Default:** `'file'`
21022102

21032103
Synchronous symlink(2). Returns `undefined`.
21042104

2105-
## fs.truncate(path, len, callback)
2105+
## fs.truncate(path[, len], callback)
21062106
<!-- YAML
21072107
added: v0.8.6
21082108
changes:
@@ -2113,20 +2113,20 @@ changes:
21132113
-->
21142114

21152115
* `path` {string|Buffer}
2116-
* `len` {integer} default = `0`
2116+
* `len` {integer} **Default:** `0`
21172117
* `callback` {Function}
21182118

21192119
Asynchronous truncate(2). No arguments other than a possible exception are
21202120
given to the completion callback. A file descriptor can also be passed as the
21212121
first argument. In this case, `fs.ftruncate()` is called.
21222122

2123-
## fs.truncateSync(path, len)
2123+
## fs.truncateSync(path[, len])
21242124
<!-- YAML
21252125
added: v0.8.6
21262126
-->
21272127

21282128
* `path` {string|Buffer}
2129-
* `len` {integer} default = `0`
2129+
* `len` {integer} **Default:** `0`
21302130

21312131
Synchronous truncate(2). Returns `undefined`. A file descriptor can also be
21322132
passed as the first argument. In this case, `fs.ftruncateSync()` is called.
@@ -2171,7 +2171,7 @@ added: v0.1.31
21712171
-->
21722172

21732173
* `filename` {string|Buffer}
2174-
* `listener` {Function}
2174+
* `listener` {Function|undefined} **Default:** `undefined`
21752175

21762176
Stop watching for changes on `filename`. If `listener` is specified, only that
21772177
particular listener is removed. Otherwise, *all* listeners are removed,
@@ -2254,14 +2254,14 @@ changes:
22542254
* `filename` {string|Buffer|URL}
22552255
* `options` {string|Object}
22562256
* `persistent` {boolean} Indicates whether the process should continue to run
2257-
as long as files are being watched. default = `true`
2257+
as long as files are being watched. **Default:** `true`
22582258
* `recursive` {boolean} Indicates whether all subdirectories should be
22592259
watched, or only the current directory. This applies when a directory is
2260-
specified, and only on supported platforms (See [Caveats][]). default =
2260+
specified, and only on supported platforms (See [Caveats][]). **Default:**
22612261
`false`
22622262
* `encoding` {string} Specifies the character encoding to be used for the
2263-
filename passed to the listener. default = `'utf8'`
2264-
* `listener` {Function}
2263+
filename passed to the listener. **Default:** `'utf8'`
2264+
* `listener` {Function|undefined} **Default:** `undefined`
22652265

22662266
Watch for changes on `filename`, where `filename` is either a file or a
22672267
directory. The returned object is a [`fs.FSWatcher`][].
@@ -2361,8 +2361,8 @@ changes:
23612361

23622362
* `filename` {string|Buffer|URL}
23632363
* `options` {Object}
2364-
* `persistent` {boolean}
2365-
* `interval` {integer}
2364+
* `persistent` {boolean} **Default:** `true`
2365+
* `interval` {integer} **Default:** `5007`
23662366
* `listener` {Function}
23672367

23682368
Watch for changes on `filename`. The callback `listener` will be called each
@@ -2510,9 +2510,9 @@ changes:
25102510
* `file` {string|Buffer|integer} filename or file descriptor
25112511
* `data` {string|Buffer|Uint8Array}
25122512
* `options` {Object|string}
2513-
* `encoding` {string|null} default = `'utf8'`
2514-
* `mode` {integer} default = `0o666`
2515-
* `flag` {string} default = `'w'`
2513+
* `encoding` {string|null} **Default:** `'utf8'`
2514+
* `mode` {integer} **Default:** `0o666`
2515+
* `flag` {string} **Default:** `'w'`
25162516
* `callback` {Function}
25172517

25182518
Asynchronously writes data to a file, replacing the file if it already exists.
@@ -2560,9 +2560,9 @@ changes:
25602560
* `file` {string|Buffer|integer} filename or file descriptor
25612561
* `data` {string|Buffer|Uint8Array}
25622562
* `options` {Object|string}
2563-
* `encoding` {string|null} default = `'utf8'`
2564-
* `mode` {integer} default = `0o666`
2565-
* `flag` {string} default = `'w'`
2563+
* `encoding` {string|null} **Default:** `'utf8'`
2564+
* `mode` {integer} **Default:** `0o666`
2565+
* `flag` {string} **Default:** `'w'`
25662566

25672567
The synchronous version of [`fs.writeFile()`][]. Returns `undefined`.
25682568

0 commit comments

Comments
 (0)