bare-fs 4.6.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -488,11 +488,7 @@ async function stat(filepath, cb) {
488
488
 
489
489
  st = new Stats(...binding.requestResultStat(req.handle))
490
490
  } catch (e) {
491
- err = new FileError(e.message, {
492
- operation: 'stat',
493
- code: e.code,
494
- path: filepath
495
- })
491
+ err = new FileError(e.message, { operation: 'stat', code: e.code, path: filepath })
496
492
  } finally {
497
493
  req.return()
498
494
  }
@@ -510,11 +506,7 @@ function statSync(filepath) {
510
506
 
511
507
  return new Stats(...binding.requestResultStat(req.handle))
512
508
  } catch (e) {
513
- throw new FileError(e.message, {
514
- operation: 'stat',
515
- code: e.code,
516
- path: filepath
517
- })
509
+ throw new FileError(e.message, { operation: 'stat', code: e.code, path: filepath })
518
510
  } finally {
519
511
  req.return()
520
512
  }
@@ -534,11 +526,7 @@ async function lstat(filepath, cb) {
534
526
 
535
527
  st = new Stats(...binding.requestResultStat(req.handle))
536
528
  } catch (e) {
537
- err = new FileError(e.message, {
538
- operation: 'lstat',
539
- code: e.code,
540
- path: filepath
541
- })
529
+ err = new FileError(e.message, { operation: 'lstat', code: e.code, path: filepath })
542
530
  } finally {
543
531
  req.return()
544
532
  }
@@ -556,11 +544,7 @@ function lstatSync(filepath) {
556
544
 
557
545
  return new Stats(...binding.requestResultStat(req.handle))
558
546
  } catch (e) {
559
- throw new FileError(e.message, {
560
- operation: 'lstat',
561
- code: e.code,
562
- path: filepath
563
- })
547
+ throw new FileError(e.message, { operation: 'lstat', code: e.code, path: filepath })
564
548
  } finally {
565
549
  req.return()
566
550
  }
@@ -600,6 +584,44 @@ function fstatSync(fd) {
600
584
  }
601
585
  }
602
586
 
587
+ async function statfs(filepath, cb) {
588
+ filepath = toNamespacedPath(filepath)
589
+
590
+ const req = FileRequest.borrow()
591
+
592
+ let st
593
+ let err = null
594
+ try {
595
+ binding.statfs(req.handle, filepath)
596
+
597
+ await req
598
+
599
+ st = new StatFs(...binding.requestResultStatfs(req.handle))
600
+ } catch (e) {
601
+ err = new FileError(e.message, { operation: 'statfs', code: e.code, path: filepath })
602
+ } finally {
603
+ req.return()
604
+ }
605
+
606
+ return done(err, st, cb)
607
+ }
608
+
609
+ function statfsSync(filepath) {
610
+ filepath = toNamespacedPath(filepath)
611
+
612
+ const req = FileRequest.borrow()
613
+
614
+ try {
615
+ binding.statfsSync(req.handle, filepath)
616
+
617
+ return new StatFs(...binding.requestResultStatfs(req.handle))
618
+ } catch (e) {
619
+ throw new FileError(e.message, { operation: 'statfs', code: e.code, path: filepath })
620
+ } finally {
621
+ req.return()
622
+ }
623
+ }
624
+
603
625
  async function ftruncate(fd, len = 0, cb) {
604
626
  if (typeof len === 'function') {
605
627
  cb = len
@@ -638,6 +660,38 @@ function ftruncateSync(fd, len = 0) {
638
660
  }
639
661
  }
640
662
 
663
+ async function truncate(filepath, len, cb) {
664
+ let fd = -1
665
+ let err
666
+
667
+ try {
668
+ fd = await open(filepath, 'r+')
669
+
670
+ await ftruncate(fd, len)
671
+ } catch (e) {
672
+ err = e
673
+ } finally {
674
+ if (fd !== -1) await close(fd)
675
+ }
676
+
677
+ return done(err, cb)
678
+ }
679
+
680
+ function truncateSync(filepath, len) {
681
+ let fd = -1
682
+ let err
683
+
684
+ try {
685
+ fd = openSync(filepath, 'r+')
686
+
687
+ ftruncateSync(fd, len)
688
+ } catch (e) {
689
+ err = e
690
+ } finally {
691
+ if (fd !== -1) closeSync(fd)
692
+ }
693
+ }
694
+
641
695
  async function chmod(filepath, mode, cb) {
642
696
  if (typeof mode === 'string') mode = toMode(mode)
643
697
 
@@ -716,6 +770,101 @@ function fchmodSync(fd, mode) {
716
770
  }
717
771
  }
718
772
 
773
+ async function chown(filepath, uid, gid, cb) {
774
+ filepath = toNamespacedPath(filepath)
775
+
776
+ const req = FileRequest.borrow()
777
+
778
+ let err = null
779
+ try {
780
+ binding.chown(req.handle, filepath, uid, gid)
781
+
782
+ await req
783
+ } catch (e) {
784
+ err = new FileError(e.message, { operation: 'chown', code: e.code, path: filepath })
785
+ } finally {
786
+ req.return()
787
+ }
788
+
789
+ return done(err, cb)
790
+ }
791
+
792
+ function chownSync(filepath, uid, gid) {
793
+ filepath = toNamespacedPath(filepath)
794
+
795
+ const req = FileRequest.borrow()
796
+
797
+ try {
798
+ binding.chownSync(req.handle, filepath, uid, gid)
799
+ } catch (e) {
800
+ throw new FileError(e.message, { operation: 'chownSync', code: e.code, path: filepath })
801
+ } finally {
802
+ req.return()
803
+ }
804
+ }
805
+
806
+ async function lchown(filepath, uid, gid, cb) {
807
+ filepath = toNamespacedPath(filepath)
808
+
809
+ const req = FileRequest.borrow()
810
+
811
+ let err = null
812
+ try {
813
+ binding.lchown(req.handle, filepath, uid, gid)
814
+
815
+ await req
816
+ } catch (e) {
817
+ err = new FileError(e.message, { operation: 'lchown', code: e.code, path: filepath })
818
+ } finally {
819
+ req.return()
820
+ }
821
+
822
+ return done(err, cb)
823
+ }
824
+
825
+ function lchownSync(filepath, uid, gid) {
826
+ filepath = toNamespacedPath(filepath)
827
+
828
+ const req = FileRequest.borrow()
829
+
830
+ try {
831
+ binding.lchownSync(req.handle, filepath, uid, gid)
832
+ } catch (e) {
833
+ throw new FileError(e.message, { operation: 'lchownSync', code: e.code, path: filepath })
834
+ } finally {
835
+ req.return()
836
+ }
837
+ }
838
+
839
+ async function fchown(fd, uid, gid, cb) {
840
+ const req = FileRequest.borrow()
841
+
842
+ let err = null
843
+ try {
844
+ binding.fchown(req.handle, fd, uid, gid)
845
+
846
+ await req
847
+ } catch (e) {
848
+ err = new FileError(e.message, { operation: 'fchown', code: e.code, fd })
849
+ } finally {
850
+ req.return()
851
+ }
852
+
853
+ return done(err, cb)
854
+ }
855
+
856
+ function fchownSync(fd, uid, gid) {
857
+ const req = FileRequest.borrow()
858
+
859
+ try {
860
+ binding.fchownSync(req.handle, fd, uid, gid)
861
+ } catch (e) {
862
+ throw new FileError(e.message, { operation: 'fchownSync', code: e.code, fd })
863
+ } finally {
864
+ req.return()
865
+ }
866
+ }
867
+
719
868
  async function utimes(filepath, atime, mtime, cb) {
720
869
  if (typeof atime !== 'number') atime = atime.getTime() / 1000
721
870
  if (typeof mtime !== 'number') mtime = mtime.getTime() / 1000
@@ -730,11 +879,7 @@ async function utimes(filepath, atime, mtime, cb) {
730
879
 
731
880
  await req
732
881
  } catch (e) {
733
- err = new FileError(e.message, {
734
- operation: 'utimes',
735
- code: e.code,
736
- path: filepath
737
- })
882
+ err = new FileError(e.message, { operation: 'utimes', code: e.code, path: filepath })
738
883
  } finally {
739
884
  req.return()
740
885
  }
@@ -752,11 +897,121 @@ function utimesSync(filepath, atime, mtime) {
752
897
 
753
898
  try {
754
899
  binding.utimesSync(req.handle, filepath, atime, mtime)
900
+ } catch (e) {
901
+ throw new FileError(e.message, { operation: 'utimes', code: e.code, path: filepath })
902
+ } finally {
903
+ req.return()
904
+ }
905
+ }
906
+
907
+ async function lutimes(filepath, atime, mtime, cb) {
908
+ if (typeof atime !== 'number') atime = atime.getTime() / 1000
909
+ if (typeof mtime !== 'number') mtime = mtime.getTime() / 1000
910
+
911
+ filepath = toNamespacedPath(filepath)
912
+
913
+ const req = FileRequest.borrow()
914
+
915
+ let err = null
916
+ try {
917
+ binding.lutimes(req.handle, filepath, atime, mtime)
918
+
919
+ await req
920
+ } catch (e) {
921
+ err = new FileError(e.message, { operation: 'lutimes', code: e.code, path: filepath })
922
+ } finally {
923
+ req.return()
924
+ }
925
+
926
+ return done(err, cb)
927
+ }
928
+
929
+ function lutimesSync(filepath, atime, mtime) {
930
+ if (typeof atime !== 'number') atime = atime.getTime() / 1000
931
+ if (typeof mtime !== 'number') mtime = mtime.getTime() / 1000
932
+
933
+ filepath = toNamespacedPath(filepath)
934
+
935
+ const req = FileRequest.borrow()
936
+
937
+ try {
938
+ binding.lutimesSync(req.handle, filepath, atime, mtime)
939
+ } catch (e) {
940
+ throw new FileError(e.message, { operation: 'lutimes', code: e.code, path: filepath })
941
+ } finally {
942
+ req.return()
943
+ }
944
+ }
945
+
946
+ async function futimes(fd, atime, mtime, cb) {
947
+ if (typeof atime !== 'number') atime = atime.getTime() / 1000
948
+ if (typeof mtime !== 'number') mtime = mtime.getTime() / 1000
949
+
950
+ const req = FileRequest.borrow()
951
+
952
+ let err = null
953
+ try {
954
+ binding.futimes(req.handle, fd, atime, mtime)
955
+
956
+ await req
957
+ } catch (e) {
958
+ err = new FileError(e.message, { operation: 'futimes', code: e.code, fd })
959
+ } finally {
960
+ req.return()
961
+ }
962
+
963
+ return done(err, cb)
964
+ }
965
+
966
+ function futimesSync(fd, atime, mtime) {
967
+ if (typeof atime !== 'number') atime = atime.getTime() / 1000
968
+ if (typeof mtime !== 'number') mtime = mtime.getTime() / 1000
969
+
970
+ const req = FileRequest.borrow()
971
+
972
+ try {
973
+ binding.futimesSync(req.handle, fd, atime, mtime)
974
+ } catch (e) {
975
+ throw new FileError(e.message, { operation: 'futimesSync', code: e.code, fd })
976
+ } finally {
977
+ req.return()
978
+ }
979
+ }
980
+
981
+ async function link(src, dst, cb) {
982
+ src = toNamespacedPath(src)
983
+ dst = toNamespacedPath(dst)
984
+
985
+ const req = FileRequest.borrow()
986
+
987
+ let err = null
988
+ try {
989
+ binding.link(req.handle, src, dst)
990
+
991
+ await req
992
+ } catch (e) {
993
+ err = new FileError(e.message, { operation: 'link', code: e.code, path: src, destination: dst })
994
+ } finally {
995
+ req.return()
996
+ }
997
+
998
+ return done(err, cb)
999
+ }
1000
+
1001
+ function linkSync(src, dst) {
1002
+ src = toNamespacedPath(src)
1003
+ dst = toNamespacedPath(dst)
1004
+
1005
+ const req = FileRequest.borrow()
1006
+
1007
+ try {
1008
+ binding.linkSync(req.handle, src, dst)
755
1009
  } catch (e) {
756
1010
  throw new FileError(e.message, {
757
- operation: 'utimes',
1011
+ operation: 'linkSync',
758
1012
  code: e.code,
759
- path: filepath
1013
+ path: src,
1014
+ destination: dst
760
1015
  })
761
1016
  } finally {
762
1017
  req.return()
@@ -872,6 +1127,44 @@ function mkdirSync(filepath, opts) {
872
1127
  }
873
1128
  }
874
1129
 
1130
+ async function mkdtemp(prefix, cb) {
1131
+ prefix = toNamespacedPath(prefix)
1132
+
1133
+ const req = FileRequest.borrow()
1134
+
1135
+ let res
1136
+ let err = null
1137
+ try {
1138
+ binding.mkdtemp(req.handle, prefix + 'XXXXXX')
1139
+
1140
+ await req
1141
+
1142
+ res = binding.requestResultPath(req.handle)
1143
+ } catch (e) {
1144
+ err = new FileError(e.message, { operation: 'mkdtemp', code: e.code, path: prefix })
1145
+ } finally {
1146
+ req.return()
1147
+ }
1148
+
1149
+ return done(err, res, cb)
1150
+ }
1151
+
1152
+ function mkdtempSync(prefix) {
1153
+ prefix = toNamespacedPath(prefix)
1154
+
1155
+ const req = FileRequest.borrow()
1156
+
1157
+ try {
1158
+ binding.mkdtempSync(req.handle, prefix + 'XXXXXX')
1159
+
1160
+ return binding.requestResultPath(req.handle)
1161
+ } catch (e) {
1162
+ throw new FileError(e.message, { operation: 'mkdtempSync', code: e.code, path: prefix })
1163
+ } finally {
1164
+ req.return()
1165
+ }
1166
+ }
1167
+
875
1168
  async function rmdir(filepath, cb) {
876
1169
  filepath = toNamespacedPath(filepath)
877
1170
 
@@ -1339,6 +1632,64 @@ function readlinkSync(filepath, opts) {
1339
1632
  }
1340
1633
  }
1341
1634
 
1635
+ async function fsync(fd, cb) {
1636
+ const req = FileRequest.borrow()
1637
+
1638
+ let err = null
1639
+ try {
1640
+ binding.fsync(req.handle, fd)
1641
+
1642
+ await req
1643
+ } catch (e) {
1644
+ err = new FileError(e.message, { operation: 'fsync', code: e.code, fd })
1645
+ } finally {
1646
+ req.return()
1647
+ }
1648
+
1649
+ return done(err, cb)
1650
+ }
1651
+
1652
+ function fsyncSync(fd) {
1653
+ const req = FileRequest.borrow()
1654
+
1655
+ try {
1656
+ binding.fsyncSync(req.handle, fd)
1657
+ } catch (e) {
1658
+ throw new FileError(e.message, { operation: 'fsyncSync', code: e.code, fd })
1659
+ } finally {
1660
+ req.return()
1661
+ }
1662
+ }
1663
+
1664
+ async function fdatasync(fd, cb) {
1665
+ const req = FileRequest.borrow()
1666
+
1667
+ let err = null
1668
+ try {
1669
+ binding.fdatasync(req.handle, fd)
1670
+
1671
+ await req
1672
+ } catch (e) {
1673
+ err = new FileError(e.message, { operation: 'fdatasync', code: e.code, fd })
1674
+ } finally {
1675
+ req.return()
1676
+ }
1677
+
1678
+ return done(err, cb)
1679
+ }
1680
+
1681
+ function fdatasyncSync(fd) {
1682
+ const req = FileRequest.borrow()
1683
+
1684
+ try {
1685
+ binding.fdatasyncSync(req.handle, fd)
1686
+ } catch (e) {
1687
+ throw new FileError(e.message, { operation: 'fdatasyncSync', code: e.code, fd })
1688
+ } finally {
1689
+ req.return()
1690
+ }
1691
+ }
1692
+
1342
1693
  function normalizeSymlinkTarget(target, type, filepath) {
1343
1694
  if (isWindows) {
1344
1695
  if (type === constants.UV_FS_SYMLINK_JUNCTION) target = path.resolve(filepath, '..', target)
@@ -1821,6 +2172,18 @@ class Stats {
1821
2172
  }
1822
2173
  }
1823
2174
 
2175
+ class StatFs {
2176
+ constructor(type, bsize, blocks, bfree, bavail, files, ffree) {
2177
+ this.type = type
2178
+ this.bsize = bsize
2179
+ this.blocks = blocks
2180
+ this.bfree = bfree
2181
+ this.bavail = bavail
2182
+ this.files = files
2183
+ this.ffree = ffree
2184
+ }
2185
+ }
2186
+
1824
2187
  class Dir {
1825
2188
  constructor(path, handle, opts = {}) {
1826
2189
  const { encoding = 'utf8', bufferSize = 32 } = opts
@@ -2285,25 +2648,24 @@ class Watcher extends EventEmitter {
2285
2648
  exports.access = access
2286
2649
  exports.appendFile = appendFile
2287
2650
  exports.chmod = chmod
2288
- // exports.chown = chown TODO
2651
+ exports.chown = chown
2289
2652
  exports.close = close
2290
2653
  exports.copyFile = copyFile
2291
2654
  exports.cp = cp
2292
2655
  exports.exists = exists
2293
2656
  exports.fchmod = fchmod
2294
- // exports.fchown = fchown TODO
2295
- // exports.fdatasync = fdatasync TODO
2657
+ exports.fchown = fchown
2658
+ exports.fdatasync = fdatasync
2296
2659
  exports.fstat = fstat
2297
- // exports.fsync = fsync TODO
2660
+ exports.fsync = fsync
2298
2661
  exports.ftruncate = ftruncate
2299
- // exports.futimes = futimes TODO
2300
- // exports.lchmod = lchmod TODO
2301
- // exports.lchown = lchown TODO
2302
- // exports.lutimes = lutimes TODO
2303
- // exports.link = link TODO
2662
+ exports.futimes = futimes
2663
+ exports.lchown = lchown
2664
+ exports.lutimes = lutimes
2665
+ exports.link = link
2304
2666
  exports.lstat = lstat
2305
2667
  exports.mkdir = mkdir
2306
- // exports.mkdtemp = mkdtemp TODO
2668
+ exports.mkdtemp = mkdtemp
2307
2669
  exports.open = open
2308
2670
  exports.opendir = opendir
2309
2671
  exports.read = read
@@ -2316,9 +2678,9 @@ exports.rename = rename
2316
2678
  exports.rm = rm
2317
2679
  exports.rmdir = rmdir
2318
2680
  exports.stat = stat
2319
- // exports.statfs = statfs TODO
2681
+ exports.statfs = statfs
2320
2682
  exports.symlink = symlink
2321
- // exports.truncate = truncate TODO
2683
+ exports.truncate = truncate
2322
2684
  exports.unlink = unlink
2323
2685
  exports.utimes = utimes
2324
2686
  exports.watch = watch
@@ -2329,25 +2691,24 @@ exports.writev = writev
2329
2691
  exports.accessSync = accessSync
2330
2692
  exports.appendFileSync = appendFileSync
2331
2693
  exports.chmodSync = chmodSync
2332
- // exports.chownSync = chownSync TODO
2694
+ exports.chownSync = chownSync
2333
2695
  exports.closeSync = closeSync
2334
2696
  exports.copyFileSync = copyFileSync
2335
2697
  exports.cpSync = cpSync
2336
2698
  exports.existsSync = existsSync
2337
2699
  exports.fchmodSync = fchmodSync
2338
- // exports.fchownSync = fchownSync TODO
2339
- // exports.fdatasyncSync = fdatasyncSync TODO
2700
+ exports.fchownSync = fchownSync
2701
+ exports.fdatasyncSync = fdatasyncSync
2340
2702
  exports.fstatSync = fstatSync
2341
- // exports.fsyncSync = fsyncSync TODO
2703
+ exports.fsyncSync = fsyncSync
2342
2704
  exports.ftruncateSync = ftruncateSync
2343
- // exports.futimesSync = futimesSync TODO
2344
- // exports.lchmodSync = lchmodSync TODO
2345
- // exports.lchownSync = lchownSync TODO
2346
- // exports.lutimesSync = lutimesSync TODO
2347
- // exports.linkSync = linkSync TODO
2705
+ exports.futimesSync = futimesSync
2706
+ exports.lchownSync = lchownSync
2707
+ exports.lutimesSync = lutimesSync
2708
+ exports.linkSync = linkSync
2348
2709
  exports.lstatSync = lstatSync
2349
2710
  exports.mkdirSync = mkdirSync
2350
- // exports.mkdtempSync = mkdtempSync TODO
2711
+ exports.mkdtempSync = mkdtempSync
2351
2712
  exports.openSync = openSync
2352
2713
  exports.opendirSync = opendirSync
2353
2714
  exports.readFileSync = readFileSync
@@ -2360,9 +2721,9 @@ exports.renameSync = renameSync
2360
2721
  exports.rmSync = rmSync
2361
2722
  exports.rmdirSync = rmdirSync
2362
2723
  exports.statSync = statSync
2363
- // exports.statfsSync = statfsSync TODO
2724
+ exports.statfsSync = statfsSync
2364
2725
  exports.symlinkSync = symlinkSync
2365
- // exports.truncateSync = truncateSync TODO
2726
+ exports.truncateSync = truncateSync
2366
2727
  exports.unlinkSync = unlinkSync
2367
2728
  exports.utimesSync = utimesSync
2368
2729
  exports.writeFileSync = writeFileSync
@@ -2372,6 +2733,7 @@ exports.writevSync = writevSync
2372
2733
  exports.promises = require('./promises')
2373
2734
 
2374
2735
  exports.Stats = Stats
2736
+ exports.StatFs = StatFs
2375
2737
  exports.Dir = Dir
2376
2738
  exports.Dirent = Dirent
2377
2739
  exports.Watcher = Watcher
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bare-fs",
3
- "version": "4.6.0",
4
- "description": "Native file system operations for Javascript",
3
+ "version": "4.7.0",
4
+ "description": "Native file system operations for Bare",
5
5
  "exports": {
6
6
  "./package": "./package.json",
7
7
  ".": {
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/promises.d.ts CHANGED
@@ -30,6 +30,8 @@ interface FileHandleEvents extends EventMap {
30
30
  }
31
31
 
32
32
  interface FileHandle extends EventEmitter<FileHandleEvents>, AsyncDisposable {
33
+ readonly fd: number
34
+
33
35
  close(): Promise<void>
34
36
 
35
37
  read(
@@ -54,6 +56,16 @@ interface FileHandle extends EventEmitter<FileHandleEvents>, AsyncDisposable {
54
56
 
55
57
  chmod(mode: string | number): Promise<void>
56
58
 
59
+ chown(uid: number, gid: number): Promise<void>
60
+
61
+ datasync(): Promise<void>
62
+
63
+ sync(): Promise<void>
64
+
65
+ truncate(len?: number): Promise<void>
66
+
67
+ utimes(atime: number | Date, mtime: number | Date): Promise<void>
68
+
57
69
  createReadStream(opts?: ReadStreamOptions): ReadStream
58
70
 
59
71
  createWriteStream(opts?: WriteStreamOptions): WriteStream
@@ -85,16 +97,26 @@ export function appendFile(
85
97
 
86
98
  export function chmod(filepath: Path, mode: string | number): Promise<void>
87
99
 
100
+ export function chown(filepath: Path, uid: number, gid: number): Promise<void>
101
+
88
102
  export function copyFile(src: Path, dst: Path, mode?: number): Promise<void>
89
103
 
90
104
  export function cp(src: Path, dst: Path, opts?: CpOptions): Promise<void>
91
105
 
106
+ export function lchown(filepath: Path, uid: number, gid: number): Promise<void>
107
+
108
+ export function lutimes(filepath: Path, atime: number | Date, mtime: number | Date): Promise<void>
109
+
110
+ export function link(src: Path, dst: Path): Promise<void>
111
+
92
112
  export function lstat(filepath: Path): Promise<Stats>
93
113
 
94
114
  export function mkdir(filepath: Path, opts?: MkdirOptions): Promise<void>
95
115
 
96
116
  export function mkdir(filepath: Path, mode: number): Promise<void>
97
117
 
118
+ export function mkdtemp(prefix: Path): Promise<string>
119
+
98
120
  export function opendir(
99
121
  filepath: Path,
100
122
  opts: OpendirOptions & { encoding?: BufferEncoding }
@@ -245,10 +267,16 @@ export function rmdir(filepath: Path): Promise<void>
245
267
 
246
268
  export function stat(filepath: Path): Promise<Stats>
247
269
 
270
+ export function statfs(filepath: Path): Promise<StatFs>
271
+
272
+ export function truncate(filepath: Path, len?: number): Promise<void>
273
+
248
274
  export function symlink(target: Path, filepath: Path, type?: string | number): Promise<void>
249
275
 
250
276
  export function unlink(filepath: Path): Promise<void>
251
277
 
278
+ export function utimes(filepath: Path, atime: number | Date, mtime: number | Date): Promise<void>
279
+
252
280
  export function watch(
253
281
  filepath: Path,
254
282
  opts: WatcherOptions & { encoding?: BufferEncoding }