@@ -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.
@@ -1648,7 +1674,7 @@ added: v0.1.96
1648
1674
1649
1675
Synchronous fdatasync(2). Returns ` undefined ` .
1650
1676
1651
- ## fs.fstat(fd, callback)
1677
+ ## fs.fstat(fd[ , options ] , callback)
1652
1678
<!-- YAML
1653
1679
added: v0.1.95
1654
1680
changes:
@@ -1660,9 +1686,16 @@ changes:
1660
1686
pr-url: https://github.com/nodejs/node/pull/7897
1661
1687
description: The `callback` parameter is no longer optional. Not passing
1662
1688
it will emit a deprecation warning with id DEP0013.
1689
+ - version: REPLACEME
1690
+ pr-url: REPLACEME
1691
+ description: Accepts an additional `options` object to specify whether
1692
+ the numeric values returned should be bigint.
1663
1693
-->
1664
1694
1665
1695
* ` fd ` {integer}
1696
+ * ` options ` {Object}
1697
+ * ` bigint ` {boolean} Whether the numeric values in the returned
1698
+ [ ` fs.Stats ` ] [ ] object should be ` bigint ` . ** Default:** ` false ` .
1666
1699
* ` callback ` {Function}
1667
1700
* ` err ` {Error}
1668
1701
* ` stats ` {fs.Stats}
@@ -1671,12 +1704,20 @@ Asynchronous fstat(2). The callback gets two arguments `(err, stats)` where
1671
1704
` stats ` is an [ ` fs.Stats ` ] [ ] object. ` fstat() ` is identical to [ ` stat() ` ] [ ] ,
1672
1705
except that the file to be stat-ed is specified by the file descriptor ` fd ` .
1673
1706
1674
- ## fs.fstatSync(fd)
1707
+ ## fs.fstatSync(fd[ , options ] )
1675
1708
<!-- YAML
1676
1709
added: v0.1.95
1710
+ changes:
1711
+ - version: REPLACEME
1712
+ pr-url: REPLACEME
1713
+ description: Accepts an additional `options` object to specify whether
1714
+ the numeric values returned should be bigint.
1677
1715
-->
1678
1716
1679
1717
* ` fd ` {integer}
1718
+ * ` options ` {Object}
1719
+ * ` bigint ` {boolean} Whether the numeric values in the returned
1720
+ [ ` fs.Stats ` ] [ ] object should be ` bigint ` . ** Default:** ` false ` .
1680
1721
* Returns: {fs.Stats}
1681
1722
1682
1723
Synchronous fstat(2).
@@ -1942,7 +1983,7 @@ changes:
1942
1983
1943
1984
Synchronous link(2). Returns ` undefined ` .
1944
1985
1945
- ## fs.lstat(path, callback)
1986
+ ## fs.lstat(path[ , options ] , callback)
1946
1987
<!-- YAML
1947
1988
added: v0.1.30
1948
1989
changes:
@@ -1958,9 +1999,16 @@ changes:
1958
1999
pr-url: https://github.com/nodejs/node/pull/7897
1959
2000
description: The `callback` parameter is no longer optional. Not passing
1960
2001
it will emit a deprecation warning with id DEP0013.
2002
+ - version: REPLACEME
2003
+ pr-url: REPLACEME
2004
+ description: Accepts an additional `options` object to specify whether
2005
+ the numeric values returned should be bigint.
1961
2006
-->
1962
2007
1963
2008
* ` path ` {string|Buffer|URL}
2009
+ * ` options ` {Object}
2010
+ * ` bigint ` {boolean} Whether the numeric values in the returned
2011
+ [ ` fs.Stats ` ] [ ] object should be ` bigint ` . ** Default:** ` false ` .
1964
2012
* ` callback ` {Function}
1965
2013
* ` err ` {Error}
1966
2014
* ` stats ` {fs.Stats}
@@ -1970,17 +2018,24 @@ Asynchronous lstat(2). The callback gets two arguments `(err, stats)` where
1970
2018
except that if ` path ` is a symbolic link, then the link itself is stat-ed,
1971
2019
not the file that it refers to.
1972
2020
1973
- ## fs.lstatSync(path)
2021
+ ## fs.lstatSync(path[ , options ] )
1974
2022
<!-- YAML
1975
2023
added: v0.1.30
1976
2024
changes:
1977
2025
- version: v7.6.0
1978
2026
pr-url: https://github.com/nodejs/node/pull/10739
1979
2027
description: The `path` parameter can be a WHATWG `URL` object using `file:`
1980
2028
protocol. Support is currently still *experimental*.
2029
+ - version: REPLACEME
2030
+ pr-url: REPLACEME
2031
+ description: Accepts an additional `options` object to specify whether
2032
+ the numeric values returned should be bigint.
1981
2033
-->
1982
2034
1983
2035
* ` path ` {string|Buffer|URL}
2036
+ * ` options ` {Object}
2037
+ * ` bigint ` {boolean} Whether the numeric values in the returned
2038
+ [ ` fs.Stats ` ] [ ] object should be ` bigint ` . ** Default:** ` false ` .
1984
2039
* Returns: {fs.Stats}
1985
2040
1986
2041
Synchronous lstat(2).
@@ -2698,7 +2753,7 @@ Synchronous rmdir(2). Returns `undefined`.
2698
2753
Using ` fs.rmdirSync() ` on a file (not a directory) results in an ` ENOENT ` error
2699
2754
on Windows and an ` ENOTDIR ` error on POSIX.
2700
2755
2701
- ## fs.stat(path, callback)
2756
+ ## fs.stat(path[ , options ] , callback)
2702
2757
<!-- YAML
2703
2758
added: v0.0.2
2704
2759
changes:
@@ -2714,9 +2769,16 @@ changes:
2714
2769
pr-url: https://github.com/nodejs/node/pull/7897
2715
2770
description: The `callback` parameter is no longer optional. Not passing
2716
2771
it will emit a deprecation warning with id DEP0013.
2772
+ - version: REPLACEME
2773
+ pr-url: REPLACEME
2774
+ description: Accepts an additional `options` object to specify whether
2775
+ the numeric values returned should be bigint.
2717
2776
-->
2718
2777
2719
2778
* ` path ` {string|Buffer|URL}
2779
+ * ` options ` {Object}
2780
+ * ` bigint ` {boolean} Whether the numeric values in the returned
2781
+ [ ` fs.Stats ` ] [ ] object should be ` bigint ` . ** Default:** ` false ` .
2720
2782
* ` callback ` {Function}
2721
2783
* ` err ` {Error}
2722
2784
* ` stats ` {fs.Stats}
@@ -2734,17 +2796,24 @@ error raised if the file is not available.
2734
2796
To check if a file exists without manipulating it afterwards, [ ` fs.access() ` ]
2735
2797
is recommended.
2736
2798
2737
- ## fs.statSync(path)
2799
+ ## fs.statSync(path[ , options ] )
2738
2800
<!-- YAML
2739
2801
added: v0.1.21
2740
2802
changes:
2741
2803
- version: v7.6.0
2742
2804
pr-url: https://github.com/nodejs/node/pull/10739
2743
2805
description: The `path` parameter can be a WHATWG `URL` object using `file:`
2744
2806
protocol. Support is currently still *experimental*.
2807
+ - version: REPLACEME
2808
+ pr-url: REPLACEME
2809
+ description: Accepts an additional `options` object to specify whether
2810
+ the numeric values returned should be bigint.
2745
2811
-->
2746
2812
2747
2813
* ` path ` {string|Buffer|URL}
2814
+ * ` options ` {Object}
2815
+ * ` bigint ` {boolean} Whether the numeric values in the returned
2816
+ [ ` fs.Stats ` ] [ ] object should be ` bigint ` . ** Default:** ` false ` .
2748
2817
* Returns: {fs.Stats}
2749
2818
2750
2819
Synchronous stat(2).
@@ -3521,10 +3590,18 @@ returned.
3521
3590
3522
3591
The ` FileHandle ` has to support reading.
3523
3592
3524
- #### filehandle.stat()
3593
+ #### filehandle.stat([ options ] )
3525
3594
<!-- YAML
3526
3595
added: v10.0.0
3596
+ changes:
3597
+ - version: REPLACEME
3598
+ pr-url: REPLACEME
3599
+ description: Accepts an additional `options` object to specify whether
3600
+ the numeric values returned should be bigint.
3527
3601
-->
3602
+ * ` options ` {Object}
3603
+ * ` bigint ` {boolean} Whether the numeric values in the returned
3604
+ [ ` fs.Stats ` ] [ ] object should be ` bigint ` . ** Default:** ` false ` .
3528
3605
* Returns: {Promise}
3529
3606
3530
3607
Retrieves the [ ` fs.Stats ` ] [ ] for the file.
@@ -3849,12 +3926,20 @@ added: v10.0.0
3849
3926
3850
3927
Asynchronous link(2). The ` Promise ` is resolved with no arguments upon success.
3851
3928
3852
- ### fsPromises.lstat(path)
3929
+ ### fsPromises.lstat(path[ , options ] )
3853
3930
<!-- YAML
3854
3931
added: v10.0.0
3932
+ changes:
3933
+ - version: REPLACEME
3934
+ pr-url: REPLACEME
3935
+ description: Accepts an additional `options` object to specify whether
3936
+ the numeric values returned should be bigint.
3855
3937
-->
3856
3938
3857
3939
* ` path ` {string|Buffer|URL}
3940
+ * ` options ` {Object}
3941
+ * ` bigint ` {boolean} Whether the numeric values in the returned
3942
+ [ ` fs.Stats ` ] [ ] object should be ` bigint ` . ** Default:** ` false ` .
3858
3943
* Returns: {Promise}
3859
3944
3860
3945
Asynchronous lstat(2). The ` Promise ` is resolved with the [ ` fs.Stats ` ] [ ] object
@@ -4035,12 +4120,20 @@ Using `fsPromises.rmdir()` on a file (not a directory) results in the
4035
4120
` Promise ` being rejected with an ` ENOENT ` error on Windows and an ` ENOTDIR `
4036
4121
error on POSIX.
4037
4122
4038
- ### fsPromises.stat(path)
4123
+ ### fsPromises.stat(path[ , options ] )
4039
4124
<!-- YAML
4040
4125
added: v10.0.0
4126
+ changes:
4127
+ - version: REPLACEME
4128
+ pr-url: REPLACEME
4129
+ description: Accepts an additional `options` object to specify whether
4130
+ the numeric values returned should be bigint.
4041
4131
-->
4042
4132
4043
4133
* ` path ` {string|Buffer|URL}
4134
+ * ` options ` {Object}
4135
+ * ` bigint ` {boolean} Whether the numeric values in the returned
4136
+ [ ` fs.Stats ` ] [ ] object should be ` bigint ` . ** Default:** ` false ` .
4044
4137
* Returns: {Promise}
4045
4138
4046
4139
The ` Promise ` is resolved with the [ ` fs.Stats ` ] [ ] object for the given ` path ` .
@@ -4496,9 +4589,9 @@ the file contents.
4496
4589
[ `fs.chown()` ] : #fs_fs_chown_path_uid_gid_callback
4497
4590
[ `fs.copyFile()` ] : #fs_fs_copyfile_src_dest_flags_callback
4498
4591
[ `fs.exists()` ] : fs.html#fs_fs_exists_path_callback
4499
- [ `fs.fstat()` ] : #fs_fs_fstat_fd_callback
4592
+ [ `fs.fstat()` ] : #fs_fs_fstat_fd_options_callback
4500
4593
[ `fs.futimes()` ] : #fs_fs_futimes_fd_atime_mtime_callback
4501
- [ `fs.lstat()` ] : #fs_fs_lstat_path_callback
4594
+ [ `fs.lstat()` ] : #fs_fs_lstat_path_options_callback
4502
4595
[ `fs.mkdir()` ] : #fs_fs_mkdir_path_mode_callback
4503
4596
[ `fs.mkdtemp()` ] : #fs_fs_mkdtemp_prefix_options_callback
4504
4597
[ `fs.open()` ] : #fs_fs_open_path_flags_mode_callback
@@ -4507,7 +4600,7 @@ the file contents.
4507
4600
[ `fs.readFileSync()` ] : #fs_fs_readfilesync_path_options
4508
4601
[ `fs.realpath()` ] : #fs_fs_realpath_path_options_callback
4509
4602
[ `fs.rmdir()` ] : #fs_fs_rmdir_path_callback
4510
- [ `fs.stat()` ] : #fs_fs_stat_path_callback
4603
+ [ `fs.stat()` ] : #fs_fs_stat_path_options_callback
4511
4604
[ `fs.utimes()` ] : #fs_fs_utimes_path_atime_mtime_callback
4512
4605
[ `fs.watch()` ] : #fs_fs_watch_filename_options_listener
4513
4606
[ `fs.write()` ] : #fs_fs_write_fd_buffer_offset_length_position_callback
0 commit comments