bare-fs 4.0.1 → 4.0.2

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.d.ts ADDED
@@ -0,0 +1,979 @@
1
+ import EventEmitter, { EventMap } from 'bare-events'
2
+ import Buffer, { BufferEncoding } from 'bare-buffer'
3
+ import { Readable, Writable } from 'bare-stream'
4
+ import promises from './promises'
5
+ import constants from './lib/constants'
6
+
7
+ export { promises, constants }
8
+
9
+ type Flag =
10
+ | 'a'
11
+ | 'a+'
12
+ | 'as'
13
+ | 'as+'
14
+ | 'ax'
15
+ | 'ax+'
16
+ | 'r'
17
+ | 'r+'
18
+ | 'rs'
19
+ | 'rs+'
20
+ | 'sa'
21
+ | 'sa+'
22
+ | 'sr'
23
+ | 'sr+'
24
+ | 'w'
25
+ | 'w+'
26
+ | 'wx'
27
+ | 'wx+'
28
+ | 'xa'
29
+ | 'xa+'
30
+ | 'xw'
31
+ | 'xw+'
32
+
33
+ interface Callback<A extends unknown[] = []> {
34
+ (err: Error | null, ...args: A): void
35
+ }
36
+
37
+ export interface Dir<T extends string | Buffer = string | Buffer>
38
+ extends Iterable<Dirent>,
39
+ AsyncIterable<Dirent> {
40
+ readonly path: string
41
+
42
+ read(cb: Callback<[dirent: Dirent<T> | null]>): void
43
+ readSync(): Dirent<T> | null
44
+
45
+ close(cb: Callback): void
46
+ closeSync(): void
47
+ }
48
+
49
+ export class Dir {
50
+ constructor(path: string, handle: Buffer, opts?: OpendirOptions)
51
+ }
52
+
53
+ export interface Dirent<T extends string | Buffer = string | Buffer> {
54
+ readonly path: string
55
+ readonly name: T
56
+ readonly type: number
57
+
58
+ isFile(): boolean
59
+ isDirectory(): boolean
60
+ isSymbolicLink(): boolean
61
+ isFIFO(): boolean
62
+ isSocket(): boolean
63
+ isCharacterDevice(): boolean
64
+ isBlockDevice(): boolean
65
+ }
66
+
67
+ export class Dirent<T extends string | Buffer = string | Buffer> {
68
+ constructor(path: string, name: T, type: number)
69
+ }
70
+
71
+ export interface Stats {
72
+ readonly dev: number
73
+ readonly mode: number
74
+ readonly nlink: number
75
+ readonly uid: number
76
+ readonly gid: number
77
+ readonly rdev: number
78
+ readonly blksize: number
79
+ readonly ino: number
80
+ readonly size: number
81
+ readonly blocks: number
82
+ readonly atimeMs: Date
83
+ readonly mtimeMs: Date
84
+ readonly ctimeMs: Date
85
+ readonly birthtimeMs: Date
86
+
87
+ isDirectory(): boolean
88
+ isFile(): boolean
89
+ isBlockDevice(): boolean
90
+ isCharacterDevice(): boolean
91
+ isFIFO(): boolean
92
+ isSymbolicLink(): boolean
93
+ isSocket(): boolean
94
+ }
95
+
96
+ export class Stats {
97
+ constructor(
98
+ dev: number,
99
+ mode: number,
100
+ nlink: number,
101
+ uid: number,
102
+ gid: number,
103
+ rdev: number,
104
+ blksize: number,
105
+ ino: number,
106
+ size: number,
107
+ blocks: number,
108
+ atimeMs: number,
109
+ mtimeMs: number,
110
+ ctimeMs: number,
111
+ birthtimeMs: number
112
+ )
113
+ }
114
+
115
+ export interface FileReadStreamOptions {
116
+ flags?: Flag
117
+ mode?: number
118
+ }
119
+
120
+ export interface FileStreamStream extends Readable {
121
+ readonly path: string
122
+ readonly fd: number
123
+ }
124
+
125
+ export class FileReadStream {
126
+ constructor(path: string, opts?: FileWriteStreamOptions)
127
+ }
128
+
129
+ export function createReadStream(
130
+ path: string,
131
+ opts?: FileReadStreamOptions
132
+ ): FileReadStream
133
+
134
+ export interface FileWriteStreamOptions {
135
+ flags?: Flag
136
+ mode?: number
137
+ }
138
+
139
+ export interface FileWriteStream extends Writable {
140
+ readonly path: string
141
+ readonly fd: number
142
+ readonly flags: Flag
143
+ readonly mode: number
144
+ }
145
+
146
+ export class FileWriteStream {
147
+ constructor(path: string, opts?: FileWriteStreamOptions)
148
+ }
149
+
150
+ export function createWriteStream(
151
+ path: string,
152
+ opts?: FileWriteStreamOptions
153
+ ): FileWriteStream
154
+
155
+ export interface WatcherOptions {
156
+ persistent?: boolean
157
+ recursive?: boolean
158
+ encoding?: BufferEncoding | 'buffer'
159
+ }
160
+
161
+ export type WatcherEventType = 'rename' | 'change'
162
+
163
+ export interface WatcherEvents<T extends string | Buffer = string | Buffer>
164
+ extends EventMap {
165
+ error: [err: Error]
166
+ change: [eventType: WatcherEventType, filename: T]
167
+ close: []
168
+ }
169
+
170
+ export interface Watcher<T extends string | Buffer = string | Buffer>
171
+ extends EventEmitter<WatcherEvents<T>>,
172
+ AsyncIterable<{ eventType: WatcherEventType; filename: T }> {
173
+ close(): void
174
+ ref(): void
175
+ unref(): void
176
+ }
177
+
178
+ export class Watcher {
179
+ constructor(path: string | Buffer, opts: WatcherOptions)
180
+ }
181
+
182
+ export function access(filepath: string, mode: number, cb: Callback): void
183
+
184
+ export function access(filepath: string, cb: Callback): void
185
+
186
+ export function accessSync(filepath: string, mode?: number): void
187
+
188
+ export interface AppendFileOptions {
189
+ encoding?: BufferEncoding
190
+ flag?: string
191
+ mode?: number
192
+ }
193
+
194
+ export function appendFile(
195
+ filepath: string,
196
+ data: string | Buffer | ArrayBufferView,
197
+ opts: AppendFileOptions,
198
+ cb: Callback
199
+ ): void
200
+
201
+ export function appendFile(
202
+ filepath: string,
203
+ data: string | Buffer | ArrayBufferView,
204
+ encoding: BufferEncoding,
205
+ cb: Callback
206
+ ): void
207
+
208
+ export function appendFile(
209
+ filepath: string,
210
+ data: string | Buffer | ArrayBufferView,
211
+ cb: Callback
212
+ ): void
213
+
214
+ export function appendFileSync(
215
+ filepath: string,
216
+ data: string | Buffer | ArrayBufferView,
217
+ opts?: AppendFileOptions
218
+ ): void
219
+
220
+ export function appendFileSync(
221
+ filepath: string,
222
+ data: string | Buffer | ArrayBufferView,
223
+ encoding: BufferEncoding
224
+ ): void
225
+
226
+ export function chmod(
227
+ filepath: string,
228
+ mode: string | number,
229
+ cb: Callback
230
+ ): void
231
+
232
+ export function chmodSync(filepath: string, mode: string | number): void
233
+
234
+ export function close(fd: number, cb?: Callback): void
235
+
236
+ export function closeSync(fd: number): void
237
+
238
+ export function copyFile(
239
+ src: string,
240
+ dst: string,
241
+ mode: number,
242
+ cb: Callback
243
+ ): void
244
+
245
+ export function copyFile(src: string, dst: string, cb: Callback): void
246
+
247
+ export function copyFileSync(src: string, dst: string, mode?: number): void
248
+
249
+ export function exists(filepath: string, cb: (exists: boolean) => void): void
250
+
251
+ export function existsSync(filepath: string): boolean
252
+
253
+ export function fchmod(fd: number, mode: string | number, cb: Callback): void
254
+
255
+ export function fchmodSync(fd: number, mode: string | number): void
256
+
257
+ export function fstat(fd: number, cb: Callback<[stats: Stats | null]>): void
258
+
259
+ export function fstatSync(fd: number): Stats
260
+
261
+ export function ftruncate(fd: number, len: number, cb: Callback): void
262
+
263
+ export function ftruncate(fd: number, cb: Callback): void
264
+
265
+ export function lstat(
266
+ filepath: string,
267
+ cb: Callback<[stats: Stats | null]>
268
+ ): void
269
+
270
+ export function lstatSync(filepath: string): Stats
271
+
272
+ export interface MkdirOptions {
273
+ mode?: number
274
+ recursive?: boolean
275
+ }
276
+
277
+ export function mkdir(filepath: string, opts: MkdirOptions, cb: Callback): void
278
+
279
+ export function mkdir(filepath: string, mode: number, cb: Callback): void
280
+
281
+ export function mkdir(filepath: string, cb: Callback): void
282
+
283
+ export function mkdirSync(filepath: string, opts?: MkdirOptions): void
284
+
285
+ export function mkdirSync(filepath: string, mode: number): void
286
+
287
+ export function open(
288
+ filepath: string,
289
+ flags: Flag | number,
290
+ mode: string | number,
291
+ cb: Callback<[fd: number]>
292
+ ): void
293
+
294
+ export function open(
295
+ filepath: string,
296
+ flags: Flag | number,
297
+ cb: Callback<[fd: number]>
298
+ ): void
299
+
300
+ export function open(filepath: string, cb: Callback<[fd: number]>): void
301
+
302
+ export function openSync(
303
+ filepath: string,
304
+ flags?: Flag | number,
305
+ mode?: string | number
306
+ ): number
307
+
308
+ export interface OpendirOptions {
309
+ encoding?: BufferEncoding | 'buffer'
310
+ bufferSize?: number
311
+ }
312
+
313
+ export function opendir(
314
+ filepath: string,
315
+ opts: OpendirOptions & { encoding?: BufferEncoding },
316
+ cb: Callback<[dir: Dir<string> | null]>
317
+ ): void
318
+
319
+ export function opendir(
320
+ filepath: string,
321
+ opts: OpendirOptions & { encoding: 'buffer' },
322
+ cb: Callback<[dir: Dir<Buffer> | null]>
323
+ ): void
324
+
325
+ export function opendir(
326
+ filepath: string,
327
+ opts: OpendirOptions,
328
+ cb: Callback<[dir: Dir | null]>
329
+ ): void
330
+
331
+ export function opendir(
332
+ filepath: string,
333
+ encoding: BufferEncoding,
334
+ cb: Callback<[dir: Dir<string> | null]>
335
+ ): void
336
+
337
+ export function opendir(
338
+ filepath: string,
339
+ encoding: 'buffer',
340
+ cb: Callback<[dir: Dir<Buffer> | null]>
341
+ ): void
342
+
343
+ export function opendir(
344
+ filepath: string,
345
+ encoding: BufferEncoding | 'buffer',
346
+ cb: Callback<[dir: Dir | null]>
347
+ ): void
348
+
349
+ export function opendir(
350
+ filepath: string,
351
+ cb: Callback<[dir: Dir<string> | null]>
352
+ ): void
353
+
354
+ export function opendirSync(
355
+ filepath: string,
356
+ opts: OpendirOptions & { encoding?: BufferEncoding }
357
+ ): Dir<string>
358
+
359
+ export function opendirSync(
360
+ filepath: string,
361
+ opts: OpendirOptions & { encoding: 'buffer' }
362
+ ): Dir<Buffer>
363
+
364
+ export function opendirSync(filepath: string, opts: OpendirOptions): Dir
365
+
366
+ export function opendirSync(
367
+ filepath: string,
368
+ encoding: BufferEncoding
369
+ ): Dir<string>
370
+
371
+ export function opendirSync(filepath: string, encoding: 'buffer'): Dir<Buffer>
372
+
373
+ export function opendirSync(
374
+ filepath: string,
375
+ encoding: BufferEncoding | 'buffer'
376
+ ): Dir
377
+
378
+ export function opendirSync(filepath: string): Dir<string>
379
+
380
+ export function read(
381
+ fd: number,
382
+ buffer: Buffer | ArrayBufferView,
383
+ offset: number,
384
+ len: number,
385
+ pos: number,
386
+ cb: Callback<[len: number]>
387
+ ): void
388
+
389
+ export function read(
390
+ fd: number,
391
+ buffer: Buffer | ArrayBufferView,
392
+ offset: number,
393
+ len: number,
394
+ cb: Callback<[len: number]>
395
+ ): void
396
+
397
+ export function read(
398
+ fd: number,
399
+ buffer: Buffer | ArrayBufferView,
400
+ offset: number,
401
+ cb: Callback<[len: number]>
402
+ ): void
403
+
404
+ export function read(
405
+ fd: number,
406
+ buffer: Buffer | ArrayBufferView,
407
+ cb: Callback<[len: number]>
408
+ ): void
409
+
410
+ export function readSync(
411
+ fd: number,
412
+ buffer: Buffer | ArrayBufferView,
413
+ offset?: number,
414
+ len?: number,
415
+ pos?: number
416
+ ): number
417
+
418
+ export interface ReadFileOptions {
419
+ encoding?: BufferEncoding | 'buffer'
420
+ flag?: Flag
421
+ }
422
+
423
+ export function readFile(
424
+ filepath: string,
425
+ opts: ReadFileOptions & { encoding: BufferEncoding },
426
+ cb: Callback<[buffer?: string]>
427
+ ): void
428
+
429
+ export function readFile(
430
+ filepath: string,
431
+ opts: ReadFileOptions & { encoding?: 'buffer' },
432
+ cb: Callback<[buffer?: Buffer]>
433
+ ): void
434
+
435
+ export function readFile(
436
+ filepath: string,
437
+ opts: ReadFileOptions,
438
+ cb: Callback<[buffer?: string | Buffer]>
439
+ ): void
440
+
441
+ export function readFile(
442
+ filepath: string,
443
+ encoding: BufferEncoding,
444
+ cb: Callback<[buffer?: string]>
445
+ ): void
446
+
447
+ export function readFile(
448
+ filepath: string,
449
+ encoding: 'buffer',
450
+ cb: Callback<[buffer?: Buffer]>
451
+ ): void
452
+
453
+ export function readFile(
454
+ filepath: string,
455
+ encoding: BufferEncoding | 'buffer',
456
+ cb: Callback<[buffer?: string | Buffer]>
457
+ ): void
458
+
459
+ export function readFile(
460
+ filepath: string,
461
+ cb: Callback<[buffer?: Buffer]>
462
+ ): void
463
+
464
+ export function readFileSync(
465
+ filepath: string,
466
+ opts: ReadFileOptions & { encoding: BufferEncoding }
467
+ ): string
468
+
469
+ export function readFileSync(
470
+ filepath: string,
471
+ opts: ReadFileOptions & { encoding?: 'buffer' }
472
+ ): Buffer
473
+
474
+ export function readFileSync(
475
+ filepath: string,
476
+ opts: ReadFileOptions
477
+ ): string | Buffer
478
+
479
+ export function readFileSync(filepath: string, encoding: BufferEncoding): string
480
+
481
+ export function readFileSync(filepath: string, encoding: 'buffer'): Buffer
482
+
483
+ export function readFileSync(
484
+ filepath: string,
485
+ encoding?: BufferEncoding | 'buffer'
486
+ ): string | Buffer
487
+
488
+ export function readFileSync(filepath: string): Buffer
489
+
490
+ export interface ReaddirOptions extends OpendirOptions {
491
+ withFileTypes?: boolean
492
+ }
493
+
494
+ export function readdir(
495
+ filepath: string,
496
+ opts: ReaddirOptions & { encoding?: BufferEncoding },
497
+ cb: Callback<[entries: Dir<string>[] | string[] | null]>
498
+ ): void
499
+
500
+ export function readdir(
501
+ filepath: string,
502
+ opts: ReaddirOptions & { encoding?: BufferEncoding; withFileTypes: true },
503
+ cb: Callback<[entries: Dir<string>[] | null]>
504
+ ): void
505
+
506
+ export function readdir(
507
+ filepath: string,
508
+ opts: ReaddirOptions & { encoding?: BufferEncoding; withFileTypes?: false },
509
+ cb: Callback<[entries: string[] | null]>
510
+ ): void
511
+
512
+ export function readdir(
513
+ filepath: string,
514
+ opts: ReaddirOptions & { encoding: 'buffer' },
515
+ cb: Callback<[entries: Dir<Buffer>[] | Buffer[] | null]>
516
+ ): void
517
+
518
+ export function readdir(
519
+ filepath: string,
520
+ opts: ReaddirOptions & { encoding: 'buffer'; withFileTypes: true },
521
+ cb: Callback<[entries: Dir<Buffer>[] | null]>
522
+ ): void
523
+
524
+ export function readdir(
525
+ filepath: string,
526
+ opts: ReaddirOptions & { encoding: 'buffer'; withFileTypes?: false },
527
+ cb: Callback<[entries: Buffer[] | null]>
528
+ ): void
529
+
530
+ export function readdir(
531
+ filepath: string,
532
+ opts: ReaddirOptions & { withFileTypes: true },
533
+ cb: Callback<[entries: Dir<string | Buffer>[] | null]>
534
+ ): void
535
+
536
+ export function readdir(
537
+ filepath: string,
538
+ opts: ReaddirOptions & { withFileTypes?: false },
539
+ cb: Callback<[entries: string[] | Buffer[] | null]>
540
+ ): void
541
+
542
+ export function readdir(
543
+ filepath: string,
544
+ opts: ReaddirOptions,
545
+ cb: Callback<[entries: Dir[] | string[] | Buffer[] | null]>
546
+ ): void
547
+
548
+ export function readdir(
549
+ filepath: string,
550
+ encoding: BufferEncoding,
551
+ cb: Callback<[entries: string[] | null]>
552
+ ): void
553
+
554
+ export function readdir(
555
+ filepath: string,
556
+ encoding: 'buffer',
557
+ cb: Callback<[entries: Buffer[] | null]>
558
+ ): void
559
+
560
+ export function readdir(
561
+ filepath: string,
562
+ encoding: BufferEncoding | 'buffer',
563
+ cb: Callback<[entries: string[] | Buffer[] | null]>
564
+ ): void
565
+
566
+ export function readdir(
567
+ filepath: string,
568
+ cb: Callback<[entries: string[] | null]>
569
+ ): void
570
+
571
+ export function readdirSync(
572
+ filepath: string,
573
+ opts: ReaddirOptions & { encoding?: BufferEncoding }
574
+ ): Dir<string>[] | string[]
575
+
576
+ export function readdirSync(
577
+ filepath: string,
578
+ opts: ReaddirOptions & { encoding?: BufferEncoding; withFileTypes: true }
579
+ ): Dir<string>[]
580
+
581
+ export function readdirSync(
582
+ filepath: string,
583
+ opts: ReaddirOptions & { encoding?: BufferEncoding; withFileTypes?: false }
584
+ ): string[]
585
+
586
+ export function readdirSync(
587
+ filepath: string,
588
+ opts: ReaddirOptions & { encoding: 'buffer' }
589
+ ): Dir<Buffer>[] | Buffer[]
590
+
591
+ export function readdirSync(
592
+ filepath: string,
593
+ opts: ReaddirOptions & { encoding: 'buffer'; withFileTypes: true }
594
+ ): Dir<Buffer>[]
595
+
596
+ export function readdirSync(
597
+ filepath: string,
598
+ opts: ReaddirOptions & { encoding: 'buffer'; withFileTypes?: false }
599
+ ): Buffer[]
600
+
601
+ export function readdirSync(
602
+ filepath: string,
603
+ opts: ReaddirOptions & { withFileTypes: true }
604
+ ): Dir<string | Buffer>[]
605
+
606
+ export function readdirSync(
607
+ filepath: string,
608
+ opts: ReaddirOptions & { withFileTypes?: false }
609
+ ): string[] | Buffer[]
610
+
611
+ export function readdirSync(
612
+ filepath: string,
613
+ opts: ReaddirOptions
614
+ ): Dir[] | string[] | Buffer[]
615
+
616
+ export function readdirSync(
617
+ filepath: string,
618
+ encoding: BufferEncoding
619
+ ): string[]
620
+
621
+ export function readdirSync(filepath: string, encoding: 'buffer'): Buffer[]
622
+
623
+ export function readdirSync(
624
+ filepath: string,
625
+ encoding: BufferEncoding | 'buffer'
626
+ ): string[] | Buffer[]
627
+
628
+ export function readdirSync(filepath: string): string[]
629
+
630
+ export interface ReadlinkOptions {
631
+ encoding?: BufferEncoding | 'buffer'
632
+ }
633
+
634
+ export function readlink(
635
+ filepath: string,
636
+ opts: ReadlinkOptions & { encoding?: BufferEncoding },
637
+ cb: Callback<[link: string | null]>
638
+ ): void
639
+
640
+ export function readlink(
641
+ filepath: string,
642
+ opts: ReadlinkOptions & { encoding: 'buffer' },
643
+ cb: Callback<[link: Buffer | null]>
644
+ ): void
645
+
646
+ export function readlink(
647
+ filepath: string,
648
+ opts: ReadlinkOptions,
649
+ cb: Callback<[link: string | Buffer | null]>
650
+ ): void
651
+
652
+ export function readlink(
653
+ filepath: string,
654
+ encoding: BufferEncoding,
655
+ cb: Callback<[link: string | null]>
656
+ ): void
657
+
658
+ export function readlink(
659
+ filepath: string,
660
+ encoding: 'buffer',
661
+ cb: Callback<[link: Buffer | null]>
662
+ ): void
663
+
664
+ export function readlink(
665
+ filepath: string,
666
+ encoding: BufferEncoding | 'buffer',
667
+ cb: Callback<[link: string | Buffer | null]>
668
+ ): void
669
+
670
+ export function readlink(
671
+ filepath: string,
672
+ cb: Callback<[link: string | null]>
673
+ ): void
674
+
675
+ export function readlinkSync(
676
+ filepath: string,
677
+ opts: ReadlinkOptions & { encoding?: BufferEncoding }
678
+ ): string
679
+
680
+ export function readlinkSync(
681
+ filepath: string,
682
+ opts: ReadlinkOptions & { encoding: 'buffer' }
683
+ ): Buffer
684
+
685
+ export function readlinkSync(
686
+ filepath: string,
687
+ opts: ReadlinkOptions
688
+ ): string | Buffer
689
+
690
+ export function readlinkSync(filepath: string, encoding: BufferEncoding): string
691
+
692
+ export function readlinkSync(filepath: string, encoding: 'buffer'): Buffer
693
+
694
+ export function readlinkSync(
695
+ filepath: string,
696
+ encoding: BufferEncoding | 'buffer'
697
+ ): string | Buffer
698
+
699
+ export function readlinkSync(filepath: string): string
700
+
701
+ export function readv(
702
+ fd: number,
703
+ buffers: ArrayBufferView[],
704
+ position: number,
705
+ cb: Callback<[len: number]>
706
+ ): void
707
+
708
+ export function readv(
709
+ fd: number,
710
+ buffers: ArrayBufferView[],
711
+ cb: Callback<[len: number]>
712
+ ): void
713
+
714
+ export interface RealpathOptions {
715
+ encoding?: BufferEncoding | 'buffer'
716
+ }
717
+
718
+ export function realpath(
719
+ filepath: string,
720
+ opts: RealpathOptions & { encoding?: BufferEncoding },
721
+ cb: Callback<[path: string | null]>
722
+ ): void
723
+
724
+ export function realpath(
725
+ filepath: string,
726
+ opts: RealpathOptions & { encoding: 'buffer' },
727
+ cb: Callback<[path: Buffer | null]>
728
+ ): void
729
+
730
+ export function realpath(
731
+ filepath: string,
732
+ opts: RealpathOptions,
733
+ cb: Callback<[path: string | Buffer | null]>
734
+ ): void
735
+
736
+ export function realpath(
737
+ filepath: string,
738
+ encoding: BufferEncoding,
739
+ cb: Callback<[path: string | null]>
740
+ ): void
741
+
742
+ export function realpath(
743
+ filepath: string,
744
+ encoding: 'buffer',
745
+ cb: Callback<[path: Buffer | null]>
746
+ ): void
747
+
748
+ export function realpath(
749
+ filepath: string,
750
+ encoding: BufferEncoding | 'buffer',
751
+ cb: Callback<[path: string | Buffer | null]>
752
+ ): void
753
+
754
+ export function realpath(
755
+ filepath: string,
756
+ cb: Callback<[path: string | null]>
757
+ ): void
758
+
759
+ export function realpathSync(
760
+ filepath: string,
761
+ opts: RealpathOptions & { encoding?: BufferEncoding }
762
+ ): string
763
+
764
+ export function realpathSync(
765
+ filepath: string,
766
+ opts: RealpathOptions & { encoding: 'buffer' }
767
+ ): Buffer
768
+
769
+ export function realpathSync(
770
+ filepath: string,
771
+ opts: RealpathOptions
772
+ ): string | Buffer
773
+
774
+ export function realpathSync(filepath: string, encoding: BufferEncoding): string
775
+
776
+ export function realpathSync(filepath: string, encoding: 'buffer'): Buffer
777
+
778
+ export function realpathSync(
779
+ filepath: string,
780
+ encoding: BufferEncoding | 'buffer'
781
+ ): string | Buffer
782
+
783
+ export function realpathSync(filepath: string): string
784
+
785
+ export function rename(src: string, dst: string, cb: Callback): void
786
+
787
+ export function renameSync(src: string, dst: string): void
788
+
789
+ export interface RmOptions {
790
+ force?: boolean
791
+ recursive?: boolean
792
+ }
793
+
794
+ export function rm(filepath: string, opts: RmOptions, cb: Callback): void
795
+
796
+ export function rm(filepath: string, cb: Callback): void
797
+
798
+ export function rmSync(filepath: string, opts?: RmOptions): void
799
+
800
+ export function rmdir(filepath: string, cb: Callback): void
801
+
802
+ export function rmdirSync(filepath: string): void
803
+
804
+ export function stat(
805
+ filepath: string,
806
+ cb: Callback<[stats: Stats | null]>
807
+ ): void
808
+
809
+ export function statSync(filepath: string): Stats
810
+
811
+ export function symlink(
812
+ target: string,
813
+ filepath: string,
814
+ type: string | number,
815
+ cb: Callback
816
+ ): void
817
+
818
+ export function symlink(target: string, filepath: string, cb: Callback): void
819
+
820
+ export function symlinkSync(
821
+ target: string,
822
+ filepath: string,
823
+ type?: string | number
824
+ ): void
825
+
826
+ export function unlink(filepath: string, cb: Callback): void
827
+
828
+ export function unlinkSync(filepath: string): void
829
+
830
+ export function watch(
831
+ filepath: string,
832
+ opts: WatcherOptions & { encoding?: BufferEncoding },
833
+ cb: (eventType: WatcherEventType, filename: string) => void
834
+ ): Watcher<string>
835
+
836
+ export function watch(
837
+ filepath: string,
838
+ opts: WatcherOptions & { encoding: 'buffer' },
839
+ cb: (eventType: WatcherEventType, filename: Buffer) => void
840
+ ): Watcher<Buffer>
841
+
842
+ export function watch(
843
+ filepath: string,
844
+ opts: WatcherOptions,
845
+ cb: (eventType: WatcherEventType, filename: string | Buffer) => void
846
+ ): Watcher
847
+
848
+ export function watch(
849
+ filepath: string,
850
+ encoding: BufferEncoding,
851
+ cb: (evenType: WatcherEventType, filename: string) => void
852
+ ): Watcher<string>
853
+
854
+ export function watch(
855
+ filepath: string,
856
+ encoding: 'buffer',
857
+ cb: (evenType: WatcherEventType, filename: Buffer) => void
858
+ ): Watcher<Buffer>
859
+
860
+ export function watch(
861
+ filepath: string,
862
+ encoding: BufferEncoding | 'buffer',
863
+ cb: (evenType: WatcherEventType, filename: string | Buffer) => void
864
+ ): Watcher
865
+
866
+ export function watch(
867
+ filepath: string,
868
+ cb: (eventType: WatcherEventType, filename: string) => void
869
+ ): Watcher<string>
870
+
871
+ export function write(
872
+ fd: number,
873
+ data: Buffer | ArrayBufferView,
874
+ offset: number,
875
+ len: number,
876
+ pos: number,
877
+ cb: Callback<[len: number]>
878
+ ): void
879
+
880
+ export function write(
881
+ fd: number,
882
+ data: Buffer | ArrayBufferView,
883
+ offset: number,
884
+ len: number,
885
+ cb: Callback<[len: number]>
886
+ ): void
887
+
888
+ export function write(
889
+ fd: number,
890
+ data: string,
891
+ pos: string | number,
892
+ encoding: BufferEncoding,
893
+ cb: Callback<[len: number]>
894
+ ): void
895
+
896
+ export function write(
897
+ fd: number,
898
+ data: Buffer | ArrayBufferView,
899
+ offset: number,
900
+ cb: Callback<[len: number]>
901
+ ): void
902
+
903
+ export function write(
904
+ fd: number,
905
+ data: string,
906
+ pos: string | number,
907
+ cb: Callback<[len: number]>
908
+ ): void
909
+
910
+ export function write(
911
+ fd: number,
912
+ data: Buffer | ArrayBufferView,
913
+ cb: Callback<[len: number]>
914
+ ): void
915
+
916
+ export function write(
917
+ fd: number,
918
+ data: string,
919
+ cb: Callback<[len: number]>
920
+ ): void
921
+
922
+ export function writeSync(
923
+ fd: number,
924
+ data: string | Buffer | ArrayBufferView,
925
+ offset?: number,
926
+ len?: number,
927
+ pos?: number
928
+ ): void
929
+
930
+ export interface WriteFileOptions {
931
+ encoding?: BufferEncoding
932
+ flag?: Flag
933
+ mode?: number
934
+ }
935
+
936
+ export function writeFile(
937
+ filepath: string,
938
+ data: string | Buffer | ArrayBufferView,
939
+ opts: WriteFileOptions,
940
+ cb: Callback
941
+ ): void
942
+
943
+ export function writeFile(
944
+ filepath: string,
945
+ data: string | Buffer | ArrayBufferView,
946
+ encoding: BufferEncoding,
947
+ cb: Callback
948
+ ): void
949
+
950
+ export function writeFile(
951
+ filepath: string,
952
+ data: string | Buffer | ArrayBufferView,
953
+ cb: Callback
954
+ ): void
955
+
956
+ export function writeFileSync(
957
+ filepath: string,
958
+ data: string | Buffer | ArrayBufferView,
959
+ opts?: WriteFileOptions
960
+ ): void
961
+
962
+ export function writeFileSync(
963
+ filepath: string,
964
+ data: string | Buffer | ArrayBufferView,
965
+ encoding: BufferEncoding
966
+ ): void
967
+
968
+ export function writev(
969
+ fd: number,
970
+ buffers: ArrayBufferView[],
971
+ pos: number,
972
+ cb: Callback<[len: number]>
973
+ ): void
974
+
975
+ export function writev(
976
+ fd: number,
977
+ buffers: ArrayBufferView[],
978
+ cb: Callback<[len: number]>
979
+ ): void