bare-fs 4.0.1 → 4.1.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.d.ts ADDED
@@ -0,0 +1,981 @@
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 ftruncateSync(fd: number, len: number): void
266
+
267
+ export function lstat(
268
+ filepath: string,
269
+ cb: Callback<[stats: Stats | null]>
270
+ ): void
271
+
272
+ export function lstatSync(filepath: string): Stats
273
+
274
+ export interface MkdirOptions {
275
+ mode?: number
276
+ recursive?: boolean
277
+ }
278
+
279
+ export function mkdir(filepath: string, opts: MkdirOptions, cb: Callback): void
280
+
281
+ export function mkdir(filepath: string, mode: number, cb: Callback): void
282
+
283
+ export function mkdir(filepath: string, cb: Callback): void
284
+
285
+ export function mkdirSync(filepath: string, opts?: MkdirOptions): void
286
+
287
+ export function mkdirSync(filepath: string, mode: number): void
288
+
289
+ export function open(
290
+ filepath: string,
291
+ flags: Flag | number,
292
+ mode: string | number,
293
+ cb: Callback<[fd: number]>
294
+ ): void
295
+
296
+ export function open(
297
+ filepath: string,
298
+ flags: Flag | number,
299
+ cb: Callback<[fd: number]>
300
+ ): void
301
+
302
+ export function open(filepath: string, cb: Callback<[fd: number]>): void
303
+
304
+ export function openSync(
305
+ filepath: string,
306
+ flags?: Flag | number,
307
+ mode?: string | number
308
+ ): number
309
+
310
+ export interface OpendirOptions {
311
+ encoding?: BufferEncoding | 'buffer'
312
+ bufferSize?: number
313
+ }
314
+
315
+ export function opendir(
316
+ filepath: string,
317
+ opts: OpendirOptions & { encoding?: BufferEncoding },
318
+ cb: Callback<[dir: Dir<string> | null]>
319
+ ): void
320
+
321
+ export function opendir(
322
+ filepath: string,
323
+ opts: OpendirOptions & { encoding: 'buffer' },
324
+ cb: Callback<[dir: Dir<Buffer> | null]>
325
+ ): void
326
+
327
+ export function opendir(
328
+ filepath: string,
329
+ opts: OpendirOptions,
330
+ cb: Callback<[dir: Dir | null]>
331
+ ): void
332
+
333
+ export function opendir(
334
+ filepath: string,
335
+ encoding: BufferEncoding,
336
+ cb: Callback<[dir: Dir<string> | null]>
337
+ ): void
338
+
339
+ export function opendir(
340
+ filepath: string,
341
+ encoding: 'buffer',
342
+ cb: Callback<[dir: Dir<Buffer> | null]>
343
+ ): void
344
+
345
+ export function opendir(
346
+ filepath: string,
347
+ encoding: BufferEncoding | 'buffer',
348
+ cb: Callback<[dir: Dir | null]>
349
+ ): void
350
+
351
+ export function opendir(
352
+ filepath: string,
353
+ cb: Callback<[dir: Dir<string> | null]>
354
+ ): void
355
+
356
+ export function opendirSync(
357
+ filepath: string,
358
+ opts: OpendirOptions & { encoding?: BufferEncoding }
359
+ ): Dir<string>
360
+
361
+ export function opendirSync(
362
+ filepath: string,
363
+ opts: OpendirOptions & { encoding: 'buffer' }
364
+ ): Dir<Buffer>
365
+
366
+ export function opendirSync(filepath: string, opts: OpendirOptions): Dir
367
+
368
+ export function opendirSync(
369
+ filepath: string,
370
+ encoding: BufferEncoding
371
+ ): Dir<string>
372
+
373
+ export function opendirSync(filepath: string, encoding: 'buffer'): Dir<Buffer>
374
+
375
+ export function opendirSync(
376
+ filepath: string,
377
+ encoding: BufferEncoding | 'buffer'
378
+ ): Dir
379
+
380
+ export function opendirSync(filepath: string): Dir<string>
381
+
382
+ export function read(
383
+ fd: number,
384
+ buffer: Buffer | ArrayBufferView,
385
+ offset: number,
386
+ len: number,
387
+ pos: number,
388
+ cb: Callback<[len: number]>
389
+ ): void
390
+
391
+ export function read(
392
+ fd: number,
393
+ buffer: Buffer | ArrayBufferView,
394
+ offset: number,
395
+ len: number,
396
+ cb: Callback<[len: number]>
397
+ ): void
398
+
399
+ export function read(
400
+ fd: number,
401
+ buffer: Buffer | ArrayBufferView,
402
+ offset: number,
403
+ cb: Callback<[len: number]>
404
+ ): void
405
+
406
+ export function read(
407
+ fd: number,
408
+ buffer: Buffer | ArrayBufferView,
409
+ cb: Callback<[len: number]>
410
+ ): void
411
+
412
+ export function readSync(
413
+ fd: number,
414
+ buffer: Buffer | ArrayBufferView,
415
+ offset?: number,
416
+ len?: number,
417
+ pos?: number
418
+ ): number
419
+
420
+ export interface ReadFileOptions {
421
+ encoding?: BufferEncoding | 'buffer'
422
+ flag?: Flag
423
+ }
424
+
425
+ export function readFile(
426
+ filepath: string,
427
+ opts: ReadFileOptions & { encoding: BufferEncoding },
428
+ cb: Callback<[buffer?: string]>
429
+ ): void
430
+
431
+ export function readFile(
432
+ filepath: string,
433
+ opts: ReadFileOptions & { encoding?: 'buffer' },
434
+ cb: Callback<[buffer?: Buffer]>
435
+ ): void
436
+
437
+ export function readFile(
438
+ filepath: string,
439
+ opts: ReadFileOptions,
440
+ cb: Callback<[buffer?: string | Buffer]>
441
+ ): void
442
+
443
+ export function readFile(
444
+ filepath: string,
445
+ encoding: BufferEncoding,
446
+ cb: Callback<[buffer?: string]>
447
+ ): void
448
+
449
+ export function readFile(
450
+ filepath: string,
451
+ encoding: 'buffer',
452
+ cb: Callback<[buffer?: Buffer]>
453
+ ): void
454
+
455
+ export function readFile(
456
+ filepath: string,
457
+ encoding: BufferEncoding | 'buffer',
458
+ cb: Callback<[buffer?: string | Buffer]>
459
+ ): void
460
+
461
+ export function readFile(
462
+ filepath: string,
463
+ cb: Callback<[buffer?: Buffer]>
464
+ ): void
465
+
466
+ export function readFileSync(
467
+ filepath: string,
468
+ opts: ReadFileOptions & { encoding: BufferEncoding }
469
+ ): string
470
+
471
+ export function readFileSync(
472
+ filepath: string,
473
+ opts: ReadFileOptions & { encoding?: 'buffer' }
474
+ ): Buffer
475
+
476
+ export function readFileSync(
477
+ filepath: string,
478
+ opts: ReadFileOptions
479
+ ): string | Buffer
480
+
481
+ export function readFileSync(filepath: string, encoding: BufferEncoding): string
482
+
483
+ export function readFileSync(filepath: string, encoding: 'buffer'): Buffer
484
+
485
+ export function readFileSync(
486
+ filepath: string,
487
+ encoding?: BufferEncoding | 'buffer'
488
+ ): string | Buffer
489
+
490
+ export function readFileSync(filepath: string): Buffer
491
+
492
+ export interface ReaddirOptions extends OpendirOptions {
493
+ withFileTypes?: boolean
494
+ }
495
+
496
+ export function readdir(
497
+ filepath: string,
498
+ opts: ReaddirOptions & { encoding?: BufferEncoding },
499
+ cb: Callback<[entries: Dir<string>[] | string[] | null]>
500
+ ): void
501
+
502
+ export function readdir(
503
+ filepath: string,
504
+ opts: ReaddirOptions & { encoding?: BufferEncoding; withFileTypes: true },
505
+ cb: Callback<[entries: Dir<string>[] | null]>
506
+ ): void
507
+
508
+ export function readdir(
509
+ filepath: string,
510
+ opts: ReaddirOptions & { encoding?: BufferEncoding; withFileTypes?: false },
511
+ cb: Callback<[entries: string[] | null]>
512
+ ): void
513
+
514
+ export function readdir(
515
+ filepath: string,
516
+ opts: ReaddirOptions & { encoding: 'buffer' },
517
+ cb: Callback<[entries: Dir<Buffer>[] | Buffer[] | null]>
518
+ ): void
519
+
520
+ export function readdir(
521
+ filepath: string,
522
+ opts: ReaddirOptions & { encoding: 'buffer'; withFileTypes: true },
523
+ cb: Callback<[entries: Dir<Buffer>[] | null]>
524
+ ): void
525
+
526
+ export function readdir(
527
+ filepath: string,
528
+ opts: ReaddirOptions & { encoding: 'buffer'; withFileTypes?: false },
529
+ cb: Callback<[entries: Buffer[] | null]>
530
+ ): void
531
+
532
+ export function readdir(
533
+ filepath: string,
534
+ opts: ReaddirOptions & { withFileTypes: true },
535
+ cb: Callback<[entries: Dir<string | Buffer>[] | null]>
536
+ ): void
537
+
538
+ export function readdir(
539
+ filepath: string,
540
+ opts: ReaddirOptions & { withFileTypes?: false },
541
+ cb: Callback<[entries: string[] | Buffer[] | null]>
542
+ ): void
543
+
544
+ export function readdir(
545
+ filepath: string,
546
+ opts: ReaddirOptions,
547
+ cb: Callback<[entries: Dir[] | string[] | Buffer[] | null]>
548
+ ): void
549
+
550
+ export function readdir(
551
+ filepath: string,
552
+ encoding: BufferEncoding,
553
+ cb: Callback<[entries: string[] | null]>
554
+ ): void
555
+
556
+ export function readdir(
557
+ filepath: string,
558
+ encoding: 'buffer',
559
+ cb: Callback<[entries: Buffer[] | null]>
560
+ ): void
561
+
562
+ export function readdir(
563
+ filepath: string,
564
+ encoding: BufferEncoding | 'buffer',
565
+ cb: Callback<[entries: string[] | Buffer[] | null]>
566
+ ): void
567
+
568
+ export function readdir(
569
+ filepath: string,
570
+ cb: Callback<[entries: string[] | null]>
571
+ ): void
572
+
573
+ export function readdirSync(
574
+ filepath: string,
575
+ opts: ReaddirOptions & { encoding?: BufferEncoding }
576
+ ): Dir<string>[] | string[]
577
+
578
+ export function readdirSync(
579
+ filepath: string,
580
+ opts: ReaddirOptions & { encoding?: BufferEncoding; withFileTypes: true }
581
+ ): Dir<string>[]
582
+
583
+ export function readdirSync(
584
+ filepath: string,
585
+ opts: ReaddirOptions & { encoding?: BufferEncoding; withFileTypes?: false }
586
+ ): string[]
587
+
588
+ export function readdirSync(
589
+ filepath: string,
590
+ opts: ReaddirOptions & { encoding: 'buffer' }
591
+ ): Dir<Buffer>[] | Buffer[]
592
+
593
+ export function readdirSync(
594
+ filepath: string,
595
+ opts: ReaddirOptions & { encoding: 'buffer'; withFileTypes: true }
596
+ ): Dir<Buffer>[]
597
+
598
+ export function readdirSync(
599
+ filepath: string,
600
+ opts: ReaddirOptions & { encoding: 'buffer'; withFileTypes?: false }
601
+ ): Buffer[]
602
+
603
+ export function readdirSync(
604
+ filepath: string,
605
+ opts: ReaddirOptions & { withFileTypes: true }
606
+ ): Dir<string | Buffer>[]
607
+
608
+ export function readdirSync(
609
+ filepath: string,
610
+ opts: ReaddirOptions & { withFileTypes?: false }
611
+ ): string[] | Buffer[]
612
+
613
+ export function readdirSync(
614
+ filepath: string,
615
+ opts: ReaddirOptions
616
+ ): Dir[] | string[] | Buffer[]
617
+
618
+ export function readdirSync(
619
+ filepath: string,
620
+ encoding: BufferEncoding
621
+ ): string[]
622
+
623
+ export function readdirSync(filepath: string, encoding: 'buffer'): Buffer[]
624
+
625
+ export function readdirSync(
626
+ filepath: string,
627
+ encoding: BufferEncoding | 'buffer'
628
+ ): string[] | Buffer[]
629
+
630
+ export function readdirSync(filepath: string): string[]
631
+
632
+ export interface ReadlinkOptions {
633
+ encoding?: BufferEncoding | 'buffer'
634
+ }
635
+
636
+ export function readlink(
637
+ filepath: string,
638
+ opts: ReadlinkOptions & { encoding?: BufferEncoding },
639
+ cb: Callback<[link: string | null]>
640
+ ): void
641
+
642
+ export function readlink(
643
+ filepath: string,
644
+ opts: ReadlinkOptions & { encoding: 'buffer' },
645
+ cb: Callback<[link: Buffer | null]>
646
+ ): void
647
+
648
+ export function readlink(
649
+ filepath: string,
650
+ opts: ReadlinkOptions,
651
+ cb: Callback<[link: string | Buffer | null]>
652
+ ): void
653
+
654
+ export function readlink(
655
+ filepath: string,
656
+ encoding: BufferEncoding,
657
+ cb: Callback<[link: string | null]>
658
+ ): void
659
+
660
+ export function readlink(
661
+ filepath: string,
662
+ encoding: 'buffer',
663
+ cb: Callback<[link: Buffer | null]>
664
+ ): void
665
+
666
+ export function readlink(
667
+ filepath: string,
668
+ encoding: BufferEncoding | 'buffer',
669
+ cb: Callback<[link: string | Buffer | null]>
670
+ ): void
671
+
672
+ export function readlink(
673
+ filepath: string,
674
+ cb: Callback<[link: string | null]>
675
+ ): void
676
+
677
+ export function readlinkSync(
678
+ filepath: string,
679
+ opts: ReadlinkOptions & { encoding?: BufferEncoding }
680
+ ): string
681
+
682
+ export function readlinkSync(
683
+ filepath: string,
684
+ opts: ReadlinkOptions & { encoding: 'buffer' }
685
+ ): Buffer
686
+
687
+ export function readlinkSync(
688
+ filepath: string,
689
+ opts: ReadlinkOptions
690
+ ): string | Buffer
691
+
692
+ export function readlinkSync(filepath: string, encoding: BufferEncoding): string
693
+
694
+ export function readlinkSync(filepath: string, encoding: 'buffer'): Buffer
695
+
696
+ export function readlinkSync(
697
+ filepath: string,
698
+ encoding: BufferEncoding | 'buffer'
699
+ ): string | Buffer
700
+
701
+ export function readlinkSync(filepath: string): string
702
+
703
+ export function readv(
704
+ fd: number,
705
+ buffers: ArrayBufferView[],
706
+ position: number,
707
+ cb: Callback<[len: number]>
708
+ ): void
709
+
710
+ export function readv(
711
+ fd: number,
712
+ buffers: ArrayBufferView[],
713
+ cb: Callback<[len: number]>
714
+ ): void
715
+
716
+ export interface RealpathOptions {
717
+ encoding?: BufferEncoding | 'buffer'
718
+ }
719
+
720
+ export function realpath(
721
+ filepath: string,
722
+ opts: RealpathOptions & { encoding?: BufferEncoding },
723
+ cb: Callback<[path: string | null]>
724
+ ): void
725
+
726
+ export function realpath(
727
+ filepath: string,
728
+ opts: RealpathOptions & { encoding: 'buffer' },
729
+ cb: Callback<[path: Buffer | null]>
730
+ ): void
731
+
732
+ export function realpath(
733
+ filepath: string,
734
+ opts: RealpathOptions,
735
+ cb: Callback<[path: string | Buffer | null]>
736
+ ): void
737
+
738
+ export function realpath(
739
+ filepath: string,
740
+ encoding: BufferEncoding,
741
+ cb: Callback<[path: string | null]>
742
+ ): void
743
+
744
+ export function realpath(
745
+ filepath: string,
746
+ encoding: 'buffer',
747
+ cb: Callback<[path: Buffer | null]>
748
+ ): void
749
+
750
+ export function realpath(
751
+ filepath: string,
752
+ encoding: BufferEncoding | 'buffer',
753
+ cb: Callback<[path: string | Buffer | null]>
754
+ ): void
755
+
756
+ export function realpath(
757
+ filepath: string,
758
+ cb: Callback<[path: string | null]>
759
+ ): void
760
+
761
+ export function realpathSync(
762
+ filepath: string,
763
+ opts: RealpathOptions & { encoding?: BufferEncoding }
764
+ ): string
765
+
766
+ export function realpathSync(
767
+ filepath: string,
768
+ opts: RealpathOptions & { encoding: 'buffer' }
769
+ ): Buffer
770
+
771
+ export function realpathSync(
772
+ filepath: string,
773
+ opts: RealpathOptions
774
+ ): string | Buffer
775
+
776
+ export function realpathSync(filepath: string, encoding: BufferEncoding): string
777
+
778
+ export function realpathSync(filepath: string, encoding: 'buffer'): Buffer
779
+
780
+ export function realpathSync(
781
+ filepath: string,
782
+ encoding: BufferEncoding | 'buffer'
783
+ ): string | Buffer
784
+
785
+ export function realpathSync(filepath: string): string
786
+
787
+ export function rename(src: string, dst: string, cb: Callback): void
788
+
789
+ export function renameSync(src: string, dst: string): void
790
+
791
+ export interface RmOptions {
792
+ force?: boolean
793
+ recursive?: boolean
794
+ }
795
+
796
+ export function rm(filepath: string, opts: RmOptions, cb: Callback): void
797
+
798
+ export function rm(filepath: string, cb: Callback): void
799
+
800
+ export function rmSync(filepath: string, opts?: RmOptions): void
801
+
802
+ export function rmdir(filepath: string, cb: Callback): void
803
+
804
+ export function rmdirSync(filepath: string): void
805
+
806
+ export function stat(
807
+ filepath: string,
808
+ cb: Callback<[stats: Stats | null]>
809
+ ): void
810
+
811
+ export function statSync(filepath: string): Stats
812
+
813
+ export function symlink(
814
+ target: string,
815
+ filepath: string,
816
+ type: string | number,
817
+ cb: Callback
818
+ ): void
819
+
820
+ export function symlink(target: string, filepath: string, cb: Callback): void
821
+
822
+ export function symlinkSync(
823
+ target: string,
824
+ filepath: string,
825
+ type?: string | number
826
+ ): void
827
+
828
+ export function unlink(filepath: string, cb: Callback): void
829
+
830
+ export function unlinkSync(filepath: string): void
831
+
832
+ export function watch(
833
+ filepath: string,
834
+ opts: WatcherOptions & { encoding?: BufferEncoding },
835
+ cb: (eventType: WatcherEventType, filename: string) => void
836
+ ): Watcher<string>
837
+
838
+ export function watch(
839
+ filepath: string,
840
+ opts: WatcherOptions & { encoding: 'buffer' },
841
+ cb: (eventType: WatcherEventType, filename: Buffer) => void
842
+ ): Watcher<Buffer>
843
+
844
+ export function watch(
845
+ filepath: string,
846
+ opts: WatcherOptions,
847
+ cb: (eventType: WatcherEventType, filename: string | Buffer) => void
848
+ ): Watcher
849
+
850
+ export function watch(
851
+ filepath: string,
852
+ encoding: BufferEncoding,
853
+ cb: (evenType: WatcherEventType, filename: string) => void
854
+ ): Watcher<string>
855
+
856
+ export function watch(
857
+ filepath: string,
858
+ encoding: 'buffer',
859
+ cb: (evenType: WatcherEventType, filename: Buffer) => void
860
+ ): Watcher<Buffer>
861
+
862
+ export function watch(
863
+ filepath: string,
864
+ encoding: BufferEncoding | 'buffer',
865
+ cb: (evenType: WatcherEventType, filename: string | Buffer) => void
866
+ ): Watcher
867
+
868
+ export function watch(
869
+ filepath: string,
870
+ cb: (eventType: WatcherEventType, filename: string) => void
871
+ ): Watcher<string>
872
+
873
+ export function write(
874
+ fd: number,
875
+ data: Buffer | ArrayBufferView,
876
+ offset: number,
877
+ len: number,
878
+ pos: number,
879
+ cb: Callback<[len: number]>
880
+ ): void
881
+
882
+ export function write(
883
+ fd: number,
884
+ data: Buffer | ArrayBufferView,
885
+ offset: number,
886
+ len: number,
887
+ cb: Callback<[len: number]>
888
+ ): void
889
+
890
+ export function write(
891
+ fd: number,
892
+ data: string,
893
+ pos: string | number,
894
+ encoding: BufferEncoding,
895
+ cb: Callback<[len: number]>
896
+ ): void
897
+
898
+ export function write(
899
+ fd: number,
900
+ data: Buffer | ArrayBufferView,
901
+ offset: number,
902
+ cb: Callback<[len: number]>
903
+ ): void
904
+
905
+ export function write(
906
+ fd: number,
907
+ data: string,
908
+ pos: string | number,
909
+ cb: Callback<[len: number]>
910
+ ): void
911
+
912
+ export function write(
913
+ fd: number,
914
+ data: Buffer | ArrayBufferView,
915
+ cb: Callback<[len: number]>
916
+ ): void
917
+
918
+ export function write(
919
+ fd: number,
920
+ data: string,
921
+ cb: Callback<[len: number]>
922
+ ): void
923
+
924
+ export function writeSync(
925
+ fd: number,
926
+ data: string | Buffer | ArrayBufferView,
927
+ offset?: number,
928
+ len?: number,
929
+ pos?: number
930
+ ): void
931
+
932
+ export interface WriteFileOptions {
933
+ encoding?: BufferEncoding
934
+ flag?: Flag
935
+ mode?: number
936
+ }
937
+
938
+ export function writeFile(
939
+ filepath: string,
940
+ data: string | Buffer | ArrayBufferView,
941
+ opts: WriteFileOptions,
942
+ cb: Callback
943
+ ): void
944
+
945
+ export function writeFile(
946
+ filepath: string,
947
+ data: string | Buffer | ArrayBufferView,
948
+ encoding: BufferEncoding,
949
+ cb: Callback
950
+ ): void
951
+
952
+ export function writeFile(
953
+ filepath: string,
954
+ data: string | Buffer | ArrayBufferView,
955
+ cb: Callback
956
+ ): void
957
+
958
+ export function writeFileSync(
959
+ filepath: string,
960
+ data: string | Buffer | ArrayBufferView,
961
+ opts?: WriteFileOptions
962
+ ): void
963
+
964
+ export function writeFileSync(
965
+ filepath: string,
966
+ data: string | Buffer | ArrayBufferView,
967
+ encoding: BufferEncoding
968
+ ): void
969
+
970
+ export function writev(
971
+ fd: number,
972
+ buffers: ArrayBufferView[],
973
+ pos: number,
974
+ cb: Callback<[len: number]>
975
+ ): void
976
+
977
+ export function writev(
978
+ fd: number,
979
+ buffers: ArrayBufferView[],
980
+ cb: Callback<[len: number]>
981
+ ): void