@@ -415,6 +415,8 @@ A `fs.Stats` object provides information about a file.
415
415
416
416
Objects returned from [ ` fs.stat() ` ] [ ] , [ ` fs.lstat() ` ] [ ] and [ ` fs.fstat() ` ] [ ] and
417
417
their 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 ` .
418
420
419
421
``` console
420
422
Stats {
@@ -438,6 +440,30 @@ Stats {
438
440
birthtime: Mon, 10 Oct 2011 23:24:11 GMT }
439
441
```
440
442
443
+ ` 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
+
441
467
### stats.isBlockDevice()
442
468
<!-- YAML
443
469
added: v0.1.10
@@ -506,61 +532,61 @@ This method is only valid when using [`fs.lstat()`][].
506
532
507
533
### stats.dev
508
534
509
- * {number}
535
+ * {number|bigint }
510
536
511
537
The numeric identifier of the device containing the file.
512
538
513
539
### stats.ino
514
540
515
- * {number}
541
+ * {number|bigint }
516
542
517
543
The file system specific "Inode" number for the file.
518
544
519
545
### stats.mode
520
546
521
- * {number}
547
+ * {number|bigint }
522
548
523
549
A bit-field describing the file type and mode.
524
550
525
551
### stats.nlink
526
552
527
- * {number}
553
+ * {number|bigint }
528
554
529
555
The number of hard-links that exist for the file.
530
556
531
557
### stats.uid
532
558
533
- * {number}
559
+ * {number|bigint }
534
560
535
561
The numeric user identifier of the user that owns the file (POSIX).
536
562
537
563
### stats.gid
538
564
539
- * {number}
565
+ * {number|bigint }
540
566
541
567
The numeric group identifier of the group that owns the file (POSIX).
542
568
543
569
### stats.rdev
544
570
545
- * {number}
571
+ * {number|bigint }
546
572
547
573
A numeric device identifier if the file is considered "special".
548
574
549
575
### stats.size
550
576
551
- * {number}
577
+ * {number|bigint }
552
578
553
579
The size of the file in bytes.
554
580
555
581
### stats.blksize
556
582
557
- * {number}
583
+ * {number|bigint }
558
584
559
585
The file system block size for i/o operations.
560
586
561
587
### stats.blocks
562
588
563
- * {number}
589
+ * {number|bigint }
564
590
565
591
The number of blocks allocated for this file.
566
592
@@ -569,7 +595,7 @@ The number of blocks allocated for this file.
569
595
added: v8.1.0
570
596
-->
571
597
572
- * {number}
598
+ * {number|bigint }
573
599
574
600
The timestamp indicating the last time this file was accessed expressed in
575
601
milliseconds since the POSIX Epoch.
@@ -579,7 +605,7 @@ milliseconds since the POSIX Epoch.
579
605
added: v8.1.0
580
606
-->
581
607
582
- * {number}
608
+ * {number|bigint }
583
609
584
610
The timestamp indicating the last time this file was modified expressed in
585
611
milliseconds since the POSIX Epoch.
@@ -589,7 +615,7 @@ milliseconds since the POSIX Epoch.
589
615
added: v8.1.0
590
616
-->
591
617
592
- * {number}
618
+ * {number|bigint }
593
619
594
620
The timestamp indicating the last time the file status was changed expressed
595
621
in milliseconds since the POSIX Epoch.
@@ -599,7 +625,7 @@ in milliseconds since the POSIX Epoch.
599
625
added: v8.1.0
600
626
-->
601
627
602
- * {number}
628
+ * {number|bigint }
603
629
604
630
The timestamp indicating the creation time of this file expressed in
605
631
milliseconds since the POSIX Epoch.
@@ -1643,7 +1669,7 @@ added: v0.1.96
1643
1669
1644
1670
Synchronous fdatasync(2). Returns ` undefined ` .
1645
1671
1646
- ## fs.fstat(fd, callback)
1672
+ ## fs.fstat(fd[ , options ] , callback)
1647
1673
<!-- YAML
1648
1674
added: v0.1.95
1649
1675
changes:
@@ -1655,9 +1681,16 @@ changes:
1655
1681
pr-url: https://github.com/nodejs/node/pull/7897
1656
1682
description: The `callback` parameter is no longer optional. Not passing
1657
1683
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.
1658
1688
-->
1659
1689
1660
1690
* ` fd ` {integer}
1691
+ * ` options ` {Object}
1692
+ * ` bigint ` {boolean} Whether the numeric values in the returned
1693
+ [ ` fs.Stats ` ] [ ] object should be ` bigint ` . ** Default:** ` false ` .
1661
1694
* ` callback ` {Function}
1662
1695
* ` err ` {Error}
1663
1696
* ` stats ` {fs.Stats}
@@ -1666,12 +1699,20 @@ Asynchronous fstat(2). The callback gets two arguments `(err, stats)` where
1666
1699
` stats ` is an [ ` fs.Stats ` ] [ ] object. ` fstat() ` is identical to [ ` stat() ` ] [ ] ,
1667
1700
except that the file to be stat-ed is specified by the file descriptor ` fd ` .
1668
1701
1669
- ## fs.fstatSync(fd)
1702
+ ## fs.fstatSync(fd[ , options ] )
1670
1703
<!-- YAML
1671
1704
added: 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.
1672
1710
-->
1673
1711
1674
1712
* ` fd ` {integer}
1713
+ * ` options ` {Object}
1714
+ * ` bigint ` {boolean} Whether the numeric values in the returned
1715
+ [ ` fs.Stats ` ] [ ] object should be ` bigint ` . ** Default:** ` false ` .
1675
1716
* Returns: {fs.Stats}
1676
1717
1677
1718
Synchronous fstat(2).
@@ -1937,7 +1978,7 @@ changes:
1937
1978
1938
1979
Synchronous link(2). Returns ` undefined ` .
1939
1980
1940
- ## fs.lstat(path, callback)
1981
+ ## fs.lstat(path[ , options ] , callback)
1941
1982
<!-- YAML
1942
1983
added: v0.1.30
1943
1984
changes:
@@ -1953,9 +1994,16 @@ changes:
1953
1994
pr-url: https://github.com/nodejs/node/pull/7897
1954
1995
description: The `callback` parameter is no longer optional. Not passing
1955
1996
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.
1956
2001
-->
1957
2002
1958
2003
* ` 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 ` .
1959
2007
* ` callback ` {Function}
1960
2008
* ` err ` {Error}
1961
2009
* ` stats ` {fs.Stats}
@@ -1965,17 +2013,24 @@ Asynchronous lstat(2). The callback gets two arguments `(err, stats)` where
1965
2013
except that if ` path ` is a symbolic link, then the link itself is stat-ed,
1966
2014
not the file that it refers to.
1967
2015
1968
- ## fs.lstatSync(path)
2016
+ ## fs.lstatSync(path[ , options ] )
1969
2017
<!-- YAML
1970
2018
added: v0.1.30
1971
2019
changes:
1972
2020
- version: v7.6.0
1973
2021
pr-url: https://github.com/nodejs/node/pull/10739
1974
2022
description: The `path` parameter can be a WHATWG `URL` object using `file:`
1975
2023
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.
1976
2028
-->
1977
2029
1978
2030
* ` 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 ` .
1979
2034
* Returns: {fs.Stats}
1980
2035
1981
2036
Synchronous lstat(2).
@@ -2693,7 +2748,7 @@ Synchronous rmdir(2). Returns `undefined`.
2693
2748
Using ` fs.rmdirSync() ` on a file (not a directory) results in an ` ENOENT ` error
2694
2749
on Windows and an ` ENOTDIR ` error on POSIX.
2695
2750
2696
- ## fs.stat(path, callback)
2751
+ ## fs.stat(path[ , options ] , callback)
2697
2752
<!-- YAML
2698
2753
added: v0.0.2
2699
2754
changes:
@@ -2709,9 +2764,16 @@ changes:
2709
2764
pr-url: https://github.com/nodejs/node/pull/7897
2710
2765
description: The `callback` parameter is no longer optional. Not passing
2711
2766
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.
2712
2771
-->
2713
2772
2714
2773
* ` 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 ` .
2715
2777
* ` callback ` {Function}
2716
2778
* ` err ` {Error}
2717
2779
* ` stats ` {fs.Stats}
@@ -2729,17 +2791,24 @@ error raised if the file is not available.
2729
2791
To check if a file exists without manipulating it afterwards, [ ` fs.access() ` ]
2730
2792
is recommended.
2731
2793
2732
- ## fs.statSync(path)
2794
+ ## fs.statSync(path[ , options ] )
2733
2795
<!-- YAML
2734
2796
added: v0.1.21
2735
2797
changes:
2736
2798
- version: v7.6.0
2737
2799
pr-url: https://github.com/nodejs/node/pull/10739
2738
2800
description: The `path` parameter can be a WHATWG `URL` object using `file:`
2739
2801
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.
2740
2806
-->
2741
2807
2742
2808
* ` 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 ` .
2743
2812
* Returns: {fs.Stats}
2744
2813
2745
2814
Synchronous stat(2).
@@ -3516,10 +3585,18 @@ returned.
3516
3585
3517
3586
The ` FileHandle ` has to support reading.
3518
3587
3519
- #### filehandle.stat()
3588
+ #### filehandle.stat([ options ] )
3520
3589
<!-- YAML
3521
3590
added: 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.
3522
3596
-->
3597
+ * ` options ` {Object}
3598
+ * ` bigint ` {boolean} Whether the numeric values in the returned
3599
+ [ ` fs.Stats ` ] [ ] object should be ` bigint ` . ** Default:** ` false ` .
3523
3600
* Returns: {Promise}
3524
3601
3525
3602
Retrieves the [ ` fs.Stats ` ] [ ] for the file.
@@ -3844,12 +3921,20 @@ added: v10.0.0
3844
3921
3845
3922
Asynchronous link(2). The ` Promise ` is resolved with no arguments upon success.
3846
3923
3847
- ### fsPromises.lstat(path)
3924
+ ### fsPromises.lstat(path[ , options ] )
3848
3925
<!-- YAML
3849
3926
added: 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.
3850
3932
-->
3851
3933
3852
3934
* ` 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 ` .
3853
3938
* Returns: {Promise}
3854
3939
3855
3940
Asynchronous 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
4030
4115
` Promise ` being rejected with an ` ENOENT ` error on Windows and an ` ENOTDIR `
4031
4116
error on POSIX.
4032
4117
4033
- ### fsPromises.stat(path)
4118
+ ### fsPromises.stat(path[ , options ] )
4034
4119
<!-- YAML
4035
4120
added: 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.
4036
4126
-->
4037
4127
4038
4128
* ` 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 ` .
4039
4132
* Returns: {Promise}
4040
4133
4041
4134
The ` Promise ` is resolved with the [ ` fs.Stats ` ] [ ] object for the given ` path ` .
@@ -4491,9 +4584,9 @@ the file contents.
4491
4584
[ `fs.chown()` ] : #fs_fs_chown_path_uid_gid_callback
4492
4585
[ `fs.copyFile()` ] : #fs_fs_copyfile_src_dest_flags_callback
4493
4586
[ `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
4495
4588
[ `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
4497
4590
[ `fs.mkdir()` ] : #fs_fs_mkdir_path_mode_callback
4498
4591
[ `fs.mkdtemp()` ] : #fs_fs_mkdtemp_prefix_options_callback
4499
4592
[ `fs.open()` ] : #fs_fs_open_path_flags_mode_callback
@@ -4502,7 +4595,7 @@ the file contents.
4502
4595
[ `fs.readFileSync()` ] : #fs_fs_readfilesync_path_options
4503
4596
[ `fs.realpath()` ] : #fs_fs_realpath_path_options_callback
4504
4597
[ `fs.rmdir()` ] : #fs_fs_rmdir_path_callback
4505
- [ `fs.stat()` ] : #fs_fs_stat_path_callback
4598
+ [ `fs.stat()` ] : #fs_fs_stat_path_options_callback
4506
4599
[ `fs.utimes()` ] : #fs_fs_utimes_path_atime_mtime_callback
4507
4600
[ `fs.watch()` ] : #fs_fs_watch_filename_options_listener
4508
4601
[ `fs.write()` ] : #fs_fs_write_fd_buffer_offset_length_position_callback
0 commit comments