doc: document BigInt support in fs.Stats · nodejs/node@fe5d351
@@ -415,6 +415,8 @@ A `fs.Stats` object provides information about a file.
415415416416Objects returned from [`fs.stat()`][], [`fs.lstat()`][] and [`fs.fstat()`][] and
417417their synchronous counterparts are of this type.
418+If `bigint` in the `options` passed to those methods is true, the numeric values
419+will be `bigint` instead of `number`.
418420419421```console
420422Stats {
@@ -438,6 +440,30 @@ Stats {
438440 birthtime: Mon, 10 Oct 2011 23:24:11 GMT }
439441```
440442443+`bigint` version:
444+445+```console
446+Stats {
447+ dev: 2114n,
448+ ino: 48064969n,
449+ mode: 33188n,
450+ nlink: 1n,
451+ uid: 85n,
452+ gid: 100n,
453+ rdev: 0n,
454+ size: 527n,
455+ blksize: 4096n,
456+ blocks: 8n,
457+ atimeMs: 1318289051000n,
458+ mtimeMs: 1318289051000n,
459+ ctimeMs: 1318289051000n,
460+ birthtimeMs: 1318289051000n,
461+ atime: Mon, 10 Oct 2011 23:24:11 GMT,
462+ mtime: Mon, 10 Oct 2011 23:24:11 GMT,
463+ ctime: Mon, 10 Oct 2011 23:24:11 GMT,
464+ birthtime: Mon, 10 Oct 2011 23:24:11 GMT }
465+```
466+441467### stats.isBlockDevice()
442468<!-- YAML
443469added: v0.1.10
@@ -506,61 +532,61 @@ This method is only valid when using [`fs.lstat()`][].
506532507533### stats.dev
508534509-* {number}
535+* {number|bigint}
510536511537The numeric identifier of the device containing the file.
512538513539### stats.ino
514540515-* {number}
541+* {number|bigint}
516542517543The file system specific "Inode" number for the file.
518544519545### stats.mode
520546521-* {number}
547+* {number|bigint}
522548523549A bit-field describing the file type and mode.
524550525551### stats.nlink
526552527-* {number}
553+* {number|bigint}
528554529555The number of hard-links that exist for the file.
530556531557### stats.uid
532558533-* {number}
559+* {number|bigint}
534560535561The numeric user identifier of the user that owns the file (POSIX).
536562537563### stats.gid
538564539-* {number}
565+* {number|bigint}
540566541567The numeric group identifier of the group that owns the file (POSIX).
542568543569### stats.rdev
544570545-* {number}
571+* {number|bigint}
546572547573A numeric device identifier if the file is considered "special".
548574549575### stats.size
550576551-* {number}
577+* {number|bigint}
552578553579The size of the file in bytes.
554580555581### stats.blksize
556582557-* {number}
583+* {number|bigint}
558584559585The file system block size for i/o operations.
560586561587### stats.blocks
562588563-* {number}
589+* {number|bigint}
564590565591The number of blocks allocated for this file.
566592@@ -569,7 +595,7 @@ The number of blocks allocated for this file.
569595added: v8.1.0
570596-->
571597572-* {number}
598+* {number|bigint}
573599574600The timestamp indicating the last time this file was accessed expressed in
575601milliseconds since the POSIX Epoch.
@@ -579,7 +605,7 @@ milliseconds since the POSIX Epoch.
579605added: v8.1.0
580606-->
581607582-* {number}
608+* {number|bigint}
583609584610The timestamp indicating the last time this file was modified expressed in
585611milliseconds since the POSIX Epoch.
@@ -589,7 +615,7 @@ milliseconds since the POSIX Epoch.
589615added: v8.1.0
590616-->
591617592-* {number}
618+* {number|bigint}
593619594620The timestamp indicating the last time the file status was changed expressed
595621in milliseconds since the POSIX Epoch.
@@ -599,7 +625,7 @@ in milliseconds since the POSIX Epoch.
599625added: v8.1.0
600626-->
601627602-* {number}
628+* {number|bigint}
603629604630The timestamp indicating the creation time of this file expressed in
605631milliseconds since the POSIX Epoch.
@@ -1643,7 +1669,7 @@ added: v0.1.96
1643166916441670Synchronous fdatasync(2). Returns `undefined`.
164516711646-## fs.fstat(fd, callback)
1672+## fs.fstat(fd[, options], callback)
16471673<!-- YAML
16481674added: v0.1.95
16491675changes:
@@ -1655,9 +1681,16 @@ changes:
16551681 pr-url: https://github.com/nodejs/node/pull/7897
16561682 description: The `callback` parameter is no longer optional. Not passing
16571683 it will emit a deprecation warning with id DEP0013.
1684+ - version: REPLACEME
1685+ pr-url: REPLACEME
1686+ description: Accepts an additional `options` object to specify whether
1687+ the numeric values returned should be bigint.
16581688-->
1659168916601690* `fd` {integer}
1691+* `options` {Object}
1692+* `bigint` {boolean} Whether the numeric values in the returned
1693+[`fs.Stats`][] object should be `bigint`. **Default:** `false`.
16611694* `callback` {Function}
16621695* `err` {Error}
16631696* `stats` {fs.Stats}
@@ -1666,12 +1699,20 @@ Asynchronous fstat(2). The callback gets two arguments `(err, stats)` where
16661699`stats` is an [`fs.Stats`][] object. `fstat()` is identical to [`stat()`][],
16671700except that the file to be stat-ed is specified by the file descriptor `fd`.
166817011669-## fs.fstatSync(fd)
1702+## fs.fstatSync(fd[, options])
16701703<!-- YAML
16711704added: v0.1.95
1705+changes:
1706+ - version: REPLACEME
1707+ pr-url: REPLACEME
1708+ description: Accepts an additional `options` object to specify whether
1709+ the numeric values returned should be bigint.
16721710-->
1673171116741712* `fd` {integer}
1713+* `options` {Object}
1714+* `bigint` {boolean} Whether the numeric values in the returned
1715+[`fs.Stats`][] object should be `bigint`. **Default:** `false`.
16751716* Returns: {fs.Stats}
1676171716771718Synchronous fstat(2).
@@ -1937,7 +1978,7 @@ changes:
1937197819381979Synchronous link(2). Returns `undefined`.
193919801940-## fs.lstat(path, callback)
1981+## fs.lstat(path[, options], callback)
19411982<!-- YAML
19421983added: v0.1.30
19431984changes:
@@ -1953,9 +1994,16 @@ changes:
19531994 pr-url: https://github.com/nodejs/node/pull/7897
19541995 description: The `callback` parameter is no longer optional. Not passing
19551996 it will emit a deprecation warning with id DEP0013.
1997+ - version: REPLACEME
1998+ pr-url: REPLACEME
1999+ description: Accepts an additional `options` object to specify whether
2000+ the numeric values returned should be bigint.
19562001-->
1957200219582003* `path` {string|Buffer|URL}
2004+* `options` {Object}
2005+* `bigint` {boolean} Whether the numeric values in the returned
2006+[`fs.Stats`][] object should be `bigint`. **Default:** `false`.
19592007* `callback` {Function}
19602008* `err` {Error}
19612009* `stats` {fs.Stats}
@@ -1965,17 +2013,24 @@ Asynchronous lstat(2). The callback gets two arguments `(err, stats)` where
19652013except that if `path` is a symbolic link, then the link itself is stat-ed,
19662014not the file that it refers to.
196720151968-## fs.lstatSync(path)
2016+## fs.lstatSync(path[, options])
19692017<!-- YAML
19702018added: v0.1.30
19712019changes:
19722020 - version: v7.6.0
19732021 pr-url: https://github.com/nodejs/node/pull/10739
19742022 description: The `path` parameter can be a WHATWG `URL` object using `file:`
19752023 protocol. Support is currently still *experimental*.
2024+ - version: REPLACEME
2025+ pr-url: REPLACEME
2026+ description: Accepts an additional `options` object to specify whether
2027+ the numeric values returned should be bigint.
19762028-->
1977202919782030* `path` {string|Buffer|URL}
2031+* `options` {Object}
2032+* `bigint` {boolean} Whether the numeric values in the returned
2033+[`fs.Stats`][] object should be `bigint`. **Default:** `false`.
19792034* Returns: {fs.Stats}
1980203519812036Synchronous lstat(2).
@@ -2693,7 +2748,7 @@ Synchronous rmdir(2). Returns `undefined`.
26932748Using `fs.rmdirSync()` on a file (not a directory) results in an `ENOENT` error
26942749on Windows and an `ENOTDIR` error on POSIX.
269527502696-## fs.stat(path, callback)
2751+## fs.stat(path[, options], callback)
26972752<!-- YAML
26982753added: v0.0.2
26992754changes:
@@ -2709,9 +2764,16 @@ changes:
27092764 pr-url: https://github.com/nodejs/node/pull/7897
27102765 description: The `callback` parameter is no longer optional. Not passing
27112766 it will emit a deprecation warning with id DEP0013.
2767+ - version: REPLACEME
2768+ pr-url: REPLACEME
2769+ description: Accepts an additional `options` object to specify whether
2770+ the numeric values returned should be bigint.
27122771-->
2713277227142773* `path` {string|Buffer|URL}
2774+* `options` {Object}
2775+* `bigint` {boolean} Whether the numeric values in the returned
2776+[`fs.Stats`][] object should be `bigint`. **Default:** `false`.
27152777* `callback` {Function}
27162778* `err` {Error}
27172779* `stats` {fs.Stats}
@@ -2729,17 +2791,24 @@ error raised if the file is not available.
27292791To check if a file exists without manipulating it afterwards, [`fs.access()`]
27302792is recommended.
273127932732-## fs.statSync(path)
2794+## fs.statSync(path[, options])
27332795<!-- YAML
27342796added: v0.1.21
27352797changes:
27362798 - version: v7.6.0
27372799 pr-url: https://github.com/nodejs/node/pull/10739
27382800 description: The `path` parameter can be a WHATWG `URL` object using `file:`
27392801 protocol. Support is currently still *experimental*.
2802+ - version: REPLACEME
2803+ pr-url: REPLACEME
2804+ description: Accepts an additional `options` object to specify whether
2805+ the numeric values returned should be bigint.
27402806-->
2741280727422808* `path` {string|Buffer|URL}
2809+* `options` {Object}
2810+* `bigint` {boolean} Whether the numeric values in the returned
2811+[`fs.Stats`][] object should be `bigint`. **Default:** `false`.
27432812* Returns: {fs.Stats}
2744281327452814Synchronous stat(2).
@@ -3516,10 +3585,18 @@ returned.
3516358535173586The `FileHandle` has to support reading.
351835873519-#### filehandle.stat()
3588+#### filehandle.stat([options])
35203589<!-- YAML
35213590added: v10.0.0
3591+changes:
3592+ - version: REPLACEME
3593+ pr-url: REPLACEME
3594+ description: Accepts an additional `options` object to specify whether
3595+ the numeric values returned should be bigint.
35223596-->
3597+* `options` {Object}
3598+* `bigint` {boolean} Whether the numeric values in the returned
3599+[`fs.Stats`][] object should be `bigint`. **Default:** `false`.
35233600* Returns: {Promise}
3524360135253602Retrieves the [`fs.Stats`][] for the file.
@@ -3844,12 +3921,20 @@ added: v10.0.0
3844392138453922Asynchronous link(2). The `Promise` is resolved with no arguments upon success.
384639233847-### fsPromises.lstat(path)
3924+### fsPromises.lstat(path[, options])
38483925<!-- YAML
38493926added: v10.0.0
3927+changes:
3928+ - version: REPLACEME
3929+ pr-url: REPLACEME
3930+ description: Accepts an additional `options` object to specify whether
3931+ the numeric values returned should be bigint.
38503932-->
3851393338523934* `path` {string|Buffer|URL}
3935+* `options` {Object}
3936+* `bigint` {boolean} Whether the numeric values in the returned
3937+[`fs.Stats`][] object should be `bigint`. **Default:** `false`.
38533938* Returns: {Promise}
3854393938553940Asynchronous lstat(2). The `Promise` is resolved with the [`fs.Stats`][] object
@@ -4030,12 +4115,20 @@ Using `fsPromises.rmdir()` on a file (not a directory) results in the
40304115`Promise` being rejected with an `ENOENT` error on Windows and an `ENOTDIR`
40314116error on POSIX.
403241174033-### fsPromises.stat(path)
4118+### fsPromises.stat(path[, options])
40344119<!-- YAML
40354120added: v10.0.0
4121+changes:
4122+ - version: REPLACEME
4123+ pr-url: REPLACEME
4124+ description: Accepts an additional `options` object to specify whether
4125+ the numeric values returned should be bigint.
40364126-->
4037412740384128* `path` {string|Buffer|URL}
4129+* `options` {Object}
4130+* `bigint` {boolean} Whether the numeric values in the returned
4131+[`fs.Stats`][] object should be `bigint`. **Default:** `false`.
40394132* Returns: {Promise}
4040413340414134The `Promise` is resolved with the [`fs.Stats`][] object for the given `path`.
@@ -4491,9 +4584,9 @@ the file contents.
44914584[`fs.chown()`]: #fs_fs_chown_path_uid_gid_callback
44924585[`fs.copyFile()`]: #fs_fs_copyfile_src_dest_flags_callback
44934586[`fs.exists()`]: fs.html#fs_fs_exists_path_callback
4494-[`fs.fstat()`]: #fs_fs_fstat_fd_callback
4587+[`fs.fstat()`]: #fs_fs_fstat_fd_options_callback
44954588[`fs.futimes()`]: #fs_fs_futimes_fd_atime_mtime_callback
4496-[`fs.lstat()`]: #fs_fs_lstat_path_callback
4589+[`fs.lstat()`]: #fs_fs_lstat_path_options_callback
44974590[`fs.mkdir()`]: #fs_fs_mkdir_path_mode_callback
44984591[`fs.mkdtemp()`]: #fs_fs_mkdtemp_prefix_options_callback
44994592[`fs.open()`]: #fs_fs_open_path_flags_mode_callback
@@ -4502,7 +4595,7 @@ the file contents.
45024595[`fs.readFileSync()`]: #fs_fs_readfilesync_path_options
45034596[`fs.realpath()`]: #fs_fs_realpath_path_options_callback
45044597[`fs.rmdir()`]: #fs_fs_rmdir_path_callback
4505-[`fs.stat()`]: #fs_fs_stat_path_callback
4598+[`fs.stat()`]: #fs_fs_stat_path_options_callback
45064599[`fs.utimes()`]: #fs_fs_utimes_path_atime_mtime_callback
45074600[`fs.watch()`]: #fs_fs_watch_filename_options_listener
45084601[`fs.write()`]: #fs_fs_write_fd_buffer_offset_length_position_callback