@@ -30,7 +30,7 @@ class ReaddirQueue extends Queue<ReaddirCallback> {
30
30
const stdio = await promisify ( exec ) ( `bash -c '${ keys . map ( ( key ) => `cd ${ escapePath ( key ) } && ls -1a; echo;` ) . join ( " " ) } '` ) ;
31
31
stdio . stdout . trim ( ) . split ( "\n\n" ) . forEach ( ( split , index ) => {
32
32
const path = keys [ index ] ;
33
- const cbs = items . get ( path ) ;
33
+ const cbs = items . get ( path ) ! ;
34
34
if ( split . indexOf ( "does not exist" ) !== - 1 ) {
35
35
cbs . forEach ( ( cb ) => {
36
36
cb ( {
@@ -262,7 +262,7 @@ function appendFile(
262
262
// @ts -ignore not sure how to make this work.
263
263
return callback ( new Error ( "not open" ) , undefined as any ) ; // tslint:disable-line no-any
264
264
}
265
- path = openFiles . get ( path ) . path ;
265
+ path = openFiles . get ( path ) ! . path ;
266
266
}
267
267
268
268
const process = exec ( `${ data ? "cat >>" : "touch" } ${ escapePath ( path . toString ( ) ) } ` , ( error ) => {
@@ -310,7 +310,7 @@ function fstat(fd: number, callback: (err: NodeJS.ErrnoException, stats: fs.Stat
310
310
if ( ! openFiles . has ( fd ) ) {
311
311
return callback ( new Error ( "not open" ) , null as any ) ; // tslint:disable-line no-any
312
312
}
313
- stat ( openFiles . get ( fd ) . path , callback ) ;
313
+ stat ( openFiles . get ( fd ) ! . path , callback ) ;
314
314
}
315
315
316
316
function futimes (
@@ -323,7 +323,7 @@ function futimes(
323
323
return callback ( new Error ( "not opened" ) ) ;
324
324
}
325
325
326
- const openFile = openFiles . get ( fd ) ;
326
+ const openFile = openFiles . get ( fd ) ! ;
327
327
const command = [
328
328
{ flag : "a" , time : atime } ,
329
329
{ flag : "m" , time : mtime } ,
@@ -344,7 +344,7 @@ function lstat(path: fs.PathLike, callback: (err: NodeJS.ErrnoException, stats:
344
344
}
345
345
346
346
function mkdir (
347
- path : fs . PathLike , mode : number | string | undefined | null | ( ( err : NodeJS . ErrnoException ) => void ) ,
347
+ path : fs . PathLike , mode : number | string | fs . MakeDirectoryOptions | undefined | null | ( ( err : NodeJS . ErrnoException ) => void ) ,
348
348
callback ?: ( err : NodeJS . ErrnoException ) => void ,
349
349
) : void {
350
350
execAndCallback (
@@ -391,7 +391,7 @@ function open(
391
391
} ) ;
392
392
}
393
393
394
- function read < TBuffer extends Buffer | Uint8Array > (
394
+ function read < TBuffer extends fs . BinaryData > (
395
395
fd : number ,
396
396
buffer : TBuffer ,
397
397
offset : number ,
@@ -409,7 +409,7 @@ function read<TBuffer extends Buffer | Uint8Array>(
409
409
}
410
410
411
411
const hasPosition = typeof position === "number" ;
412
- const openFile = openFiles . get ( fd ) ;
412
+ const openFile = openFiles . get ( fd ) ! ;
413
413
414
414
if ( ! hasPosition ) {
415
415
position = openFile . position || 0 ;
@@ -427,6 +427,7 @@ function read<TBuffer extends Buffer | Uint8Array>(
427
427
428
428
const output = data . slice ( position ! , position ! + length ) ;
429
429
if ( output . length !== 0 ) {
430
+ // TODO: seems to be no more set with v10, but need to decide if we'll be running v10.
430
431
buffer . set ( output , offset ) ;
431
432
}
432
433
@@ -459,7 +460,7 @@ function readFile(
459
460
// @ts -ignore not sure how to make this work.
460
461
return callback ( new Error ( "not open" ) , undefined as any ) ; // tslint:disable-line no-any
461
462
}
462
- path = openFiles . get ( path ) . path ;
463
+ path = openFiles . get ( path ) ! . path ;
463
464
}
464
465
465
466
readFileQueue . add ( path . toString ( ) , ( error , result ) => {
@@ -473,8 +474,8 @@ function readFile(
473
474
474
475
function readdir (
475
476
path : fs . PathLike ,
476
- options : { encoding ?: string | null } | string | undefined | null | ( ( err : NodeJS . ErrnoException , files : string [ ] ) => void ) ,
477
- callback ?: ( ( err : NodeJS . ErrnoException , files : string [ ] ) => void ) | ( ( err : NodeJS . ErrnoException , files : Buffer [ ] ) => void ) | ( ( err : NodeJS . ErrnoException , files : Array < string | Buffer > ) => void ) ,
477
+ options : { encoding ?: string | null , withFileTypes ?: boolean } | string | undefined | null | ( ( err : NodeJS . ErrnoException , files : string [ ] ) => void ) ,
478
+ callback ?: ( ( err : NodeJS . ErrnoException , files : string [ ] ) => void ) | ( ( err : NodeJS . ErrnoException , files : Buffer [ ] ) => void ) | ( ( err : NodeJS . ErrnoException , files : fs . Dirent [ ] ) => void )
478
479
) : void {
479
480
if ( typeof options === "function" ) {
480
481
callback = options ;
@@ -596,7 +597,7 @@ function writeFile(
596
597
// @ts -ignore not sure how to make this work.
597
598
return callback ( new Error ( "not open" ) , undefined as any ) ; // tslint:disable-line no-any
598
599
}
599
- path = openFiles . get ( path ) . path ;
600
+ path = openFiles . get ( path ) ! . path ;
600
601
}
601
602
602
603
const process = exec ( `${ data ? "cat >" : "touch" } ${ escapePath ( path . toString ( ) ) } ` , ( error ) => {
@@ -627,13 +628,16 @@ rmdir.__promisify__ = undefined as any;
627
628
stat . __promisify__ = undefined as any ;
628
629
unlink . __promisify__ = undefined as any ;
629
630
writeFile . __promisify__ = undefined as any ;
631
+ realpath . native = undefined as any ;
630
632
// tslint:enable no-any
631
633
632
634
const exp : typeof fs = {
633
635
constants : fs . constants ,
634
636
Stats : fs . Stats ,
635
637
ReadStream : fs . ReadStream ,
636
638
WriteStream : fs . WriteStream ,
639
+ Dirent : fs . Dirent ,
640
+ promises : fs . promises ,
637
641
638
642
access : throwUnimplementedError ,
639
643
accessSync : throwSyncError ,
0 commit comments