@@ -7,7 +7,6 @@ import _root_.net.exoego.scalajs.types.util.Factory
7
7
8
8
import scala .scalajs .js
9
9
import scala .scalajs .js .annotation .JSImport
10
- import scala .scalajs .js .typedarray
11
10
import scala .scalajs .js .|
12
11
13
12
/**
@@ -430,9 +429,11 @@ trait Fs extends js.Object with FSConstants {
430
429
/**
431
430
* Asynchronous mkdir(2). No arguments other than a possible exception are given to the completion callback.
432
431
* mode defaults to 0o777.
432
+ *
433
+ * After v13.11.0, in recursive mode, the `callback`` now receives the first created path as an 2nd argument.
433
434
* @example fs.mkdir(path[, mode], callback)
434
435
*/
435
- def mkdir (path : Path , mode : MkdirOptions , callback : FsCallback0 ): Unit = js.native
436
+ def mkdir (path : Path , mode : MkdirOptions , callback : FsCallback0 | FsRecursiveCallback0 ): Unit = js.native
436
437
437
438
/**
438
439
* Asynchronous mkdir(2). No arguments other than a possible exception are given to the completion callback.
@@ -448,7 +449,10 @@ trait Fs extends js.Object with FSConstants {
448
449
*/
449
450
def mkdirSync (path : Path , mode : FileMode = js.native): Unit = js.native
450
451
451
- def mkdirSync (path : Path , mode : MkdirOptions ): Unit = js.native
452
+ /**
453
+ * @return After Node.js v13.11.0, in recursive mode, the first created path is returned now. Otherwise undefined
454
+ */
455
+ def mkdirSync (path : Path , mode : MkdirOptions ): js.UndefOr [Path ] = js.native
452
456
453
457
/**
454
458
* Creates a unique temporary directory.
@@ -595,6 +599,9 @@ trait Fs extends js.Object with FSConstants {
595
599
callback : FsCallback2 [Int , Buffer ]
596
600
): Unit = js.native
597
601
602
+ @ enableIf(io.scalajs.nodejs.internal.CompilerSwitches .gteNodeJs14)
603
+ def read (fd : FileDescriptor , options : ReadOptions , callback : FsCallback2 [Int , Buffer ]): Unit = js.native
604
+
598
605
/**
599
606
* Synchronous version of fs.read().
600
607
* @param fd is the file descriptor
@@ -609,6 +616,17 @@ trait Fs extends js.Object with FSConstants {
609
616
610
617
def readSync (fd : FileDescriptor , buffer : BufferLike , offset : Int , length : Int , position : Int ): Int = js.native
611
618
619
+ @ enableIf(io.scalajs.nodejs.internal.CompilerSwitches .gteNodeJs14)
620
+ def readv (fd : FileDescriptor ,
621
+ buffers : js.Array [js.typedarray.ArrayBufferView ],
622
+ options : ReadOptions ,
623
+ callback : FsCallback2 [Int , js.Array [js.typedarray.ArrayBufferView ]]
624
+ ): Unit = js.native
625
+
626
+ @ enableIf(io.scalajs.nodejs.internal.CompilerSwitches .gteNodeJs14)
627
+ def readvSync (fd : FileDescriptor , buffers : js.Array [js.typedarray.ArrayBufferView ], options : ReadOptions ): Unit =
628
+ js.native
629
+
612
630
/**
613
631
* Asynchronous readdir(3). Reads the contents of a directory.
614
632
* @param path the path (Buffer | String)
@@ -974,7 +992,7 @@ trait Fs extends js.Object with FSConstants {
974
992
* @param options the [[FSWatcherOptions optional settings ]]
975
993
* @param listener the callback
976
994
*/
977
- def watchFile (filename : Path , options : FileWatcherOptions , listener : js.Function2 [Stats , Stats , Any ]): Unit =
995
+ def watchFile (filename : Path , options : FileWatcherOptions , listener : js.Function2 [Stats , Stats , Any ]): FSStatWatcher =
978
996
js.native
979
997
980
998
/**
@@ -987,7 +1005,7 @@ trait Fs extends js.Object with FSConstants {
987
1005
* @param filename the filename (Buffer | String)
988
1006
* @param listener the callback
989
1007
*/
990
- def watchFile (filename : Path , listener : js.Function2 [Stats , Stats , Any ]): Unit = js.native
1008
+ def watchFile (filename : Path , listener : js.Function2 [Stats , Stats , Any ]): FSStatWatcher = js.native
991
1009
992
1010
/**
993
1011
* Write buffer to the file specified by fd.
@@ -1007,7 +1025,7 @@ trait Fs extends js.Object with FSConstants {
1007
1025
* @example {{{ fs.write(fd, buffer[, offset[, length[, position]]], callback) }}}
1008
1026
**/
1009
1027
def write (fd : FileDescriptor ,
1010
- buffer : typedarray.Uint8Array ,
1028
+ buffer : js. typedarray.Uint8Array ,
1011
1029
offset : Int | Null ,
1012
1030
length : Int | Null ,
1013
1031
position : Int | Null ,
@@ -1054,9 +1072,9 @@ trait Fs extends js.Object with FSConstants {
1054
1072
* The encoding option is ignored if data is a buffer. It defaults to 'utf8'
1055
1073
* @example fs.writeFile(file, data[, options], callback)
1056
1074
*/
1057
- def writeFile (file : String , data : typedarray.Uint8Array , options : FileWriteOptions , callback : FsCallback0 ): Unit =
1075
+ def writeFile (file : String , data : js. typedarray.Uint8Array , options : FileWriteOptions , callback : FsCallback0 ): Unit =
1058
1076
js.native
1059
- def writeFile (file : String , data : typedarray.Uint8Array , callback : FsCallback0 ): Unit = js.native
1077
+ def writeFile (file : String , data : js. typedarray.Uint8Array , callback : FsCallback0 ): Unit = js.native
1060
1078
def writeFile (file : String , data : String , options : FileWriteOptions , callback : FsCallback0 ): Unit =
1061
1079
js.native
1062
1080
def writeFile (file : String , data : String , callback : FsCallback0 ): Unit = js.native
@@ -1070,7 +1088,7 @@ trait Fs extends js.Object with FSConstants {
1070
1088
* @example fs.writeFileSync(file, data[, options])
1071
1089
*/
1072
1090
def writeFileSync (file : Path | FileDescriptor ,
1073
- data : typedarray.Uint8Array ,
1091
+ data : js. typedarray.Uint8Array ,
1074
1092
options : FileWriteOptions = js.native
1075
1093
): Unit =
1076
1094
js.native
@@ -1092,14 +1110,14 @@ trait Fs extends js.Object with FSConstants {
1092
1110
* @example {{{ fs.writeSync(fd, buffer[, offset[, length[, position]]]) }}}
1093
1111
*/
1094
1112
def writeSync (fd : FileDescriptor ,
1095
- buffer : typedarray.Uint8Array ,
1113
+ buffer : js. typedarray.Uint8Array ,
1096
1114
offset : Int ,
1097
1115
length : Int ,
1098
1116
position : Int = js.native
1099
1117
): Unit =
1100
1118
js.native
1101
- def writeSync (fd : FileDescriptor , buffer : typedarray.Uint8Array , offset : Int ): Unit = js.native
1102
- def writeSync (fd : FileDescriptor , buffer : typedarray.Uint8Array ): Unit = js.native
1119
+ def writeSync (fd : FileDescriptor , buffer : js. typedarray.Uint8Array , offset : Int ): Unit = js.native
1120
+ def writeSync (fd : FileDescriptor , buffer : js. typedarray.Uint8Array ): Unit = js.native
1103
1121
def writeSync (fd : FileDescriptor , buffer : BufferLike , offset : Int , length : Int , position : Int ): Unit = js.native
1104
1122
def writeSync (fd : FileDescriptor , buffer : BufferLike , offset : Int , length : Int ): Unit = js.native
1105
1123
def writeSync (fd : FileDescriptor , buffer : BufferLike , offset : Int ): Unit = js.native
@@ -1120,13 +1138,15 @@ trait Fs extends js.Object with FSConstants {
1120
1138
1121
1139
@ enableIf(io.scalajs.nodejs.internal.CompilerSwitches .gteNodeJs12)
1122
1140
def writev (fd : FileDescriptor ,
1123
- buffers : js.Array [typedarray.ArrayBufferView ],
1141
+ buffers : js.Array [js. typedarray.ArrayBufferView ],
1124
1142
position : Int ,
1125
- fsCallback2 : FsCallback2 [Int , js.Array [typedarray.ArrayBufferView ]]
1143
+ fsCallback2 : FsCallback2 [Int , js.Array [js. typedarray.ArrayBufferView ]]
1126
1144
): Unit = js.native
1127
1145
@ enableIf(io.scalajs.nodejs.internal.CompilerSwitches .gteNodeJs12)
1128
- def writevSync (fd : FileDescriptor , buffers : js.Array [typedarray.ArrayBufferView ], position : Int = js.native): Unit =
1129
- js.native
1146
+ def writevSync (fd : FileDescriptor ,
1147
+ buffers : js.Array [js.typedarray.ArrayBufferView ],
1148
+ position : Int = js.native
1149
+ ): Unit = js.native
1130
1150
}
1131
1151
1132
1152
/**
@@ -1190,7 +1210,10 @@ object Fs extends Fs {
1190
1210
offset : Int | Null ,
1191
1211
length : Int | Null ,
1192
1212
position : Int | Null
1193
- ): js.Promise [BufferIOResult [T ]] = js.native
1213
+ ): js.Promise [BufferIOResult [T ]] = js.native
1214
+ @ enableIf(io.scalajs.nodejs.internal.CompilerSwitches .gteNodeJs14)
1215
+ def readd [T <: js.typedarray.TypedArray [_, _]](options : ReadOptions ): js.Promise [BufferIOResult [T ]] = js.native
1216
+
1194
1217
def readFile (): js.Promise [Buffer ] = js.native
1195
1218
def readFile (encoding : String ): js.Promise [String ] = js.native
1196
1219
def readFile (options : ReadFileOptions ): js.Promise [Output ] = js.native
@@ -1264,6 +1287,14 @@ trait FileEncodingOptions {
1264
1287
var encoding : js.UndefOr [String ] = js.undefined
1265
1288
}
1266
1289
1290
+ @ Factory
1291
+ trait ReadOptions extends js.Object {
1292
+ var buffer : js.UndefOr [BufferLike ] = js.undefined
1293
+ var offset : js.UndefOr [Int ] = js.undefined
1294
+ var length : js.UndefOr [Int ] = js.undefined
1295
+ var position : js.UndefOr [Int ] = js.undefined
1296
+ }
1297
+
1267
1298
@ Factory
1268
1299
trait ReaddirOptions extends js.Object {
1269
1300
var encoding : js.UndefOr [String ] = js.undefined
@@ -1272,7 +1303,8 @@ trait ReaddirOptions extends js.Object {
1272
1303
1273
1304
@ Factory
1274
1305
trait OpendirOptions extends js.Object {
1275
- var encoding : js.UndefOr [String ] = js.undefined
1306
+ var encoding : js.UndefOr [String ] = js.undefined
1307
+ @ enableIf(io.scalajs.nodejs.internal.CompilerSwitches .gteNodeJs12)
1276
1308
var bufferSize : js.UndefOr [Double ] = js.undefined
1277
1309
}
1278
1310
@@ -1292,6 +1324,9 @@ trait FileInputOptions extends js.Object {
1292
1324
var start : js.UndefOr [Int ] = js.undefined
1293
1325
var end : js.UndefOr [Int ] = js.undefined
1294
1326
var highWaterMark : js.UndefOr [Int ] = js.undefined
1327
+
1328
+ @ enableIf(io.scalajs.nodejs.internal.CompilerSwitches .gteNodeJs14)
1329
+ var fs : js.UndefOr [js.Object ] = js.undefined
1295
1330
}
1296
1331
1297
1332
@ Factory
@@ -1303,6 +1338,9 @@ trait FileOutputOptions extends js.Object {
1303
1338
var autoClose : js.UndefOr [Boolean ] = js.undefined
1304
1339
var emitClose : js.UndefOr [Boolean ] = js.undefined
1305
1340
var start : js.UndefOr [Int ] = js.undefined
1341
+
1342
+ @ enableIf(io.scalajs.nodejs.internal.CompilerSwitches .gteNodeJs14)
1343
+ var fs : js.UndefOr [js.Object ] = js.undefined
1306
1344
}
1307
1345
1308
1346
@ Factory
@@ -1324,8 +1362,19 @@ trait MkdirOptions extends js.Object {
1324
1362
1325
1363
@ Factory
1326
1364
trait RmdirOptions extends js.Object {
1327
- var emfileWait : js.UndefOr [Int ] = js.undefined
1328
- var maxBusyTries : js.UndefOr [Int ] = js.undefined
1365
+ @ deprecated(
1366
+ " Tha option has been removed, and EMFILE errors use the same retry logic as other errors." ,
1367
+ " Node.js v13.3.0, v12.16.0"
1368
+ )
1369
+ var emfileWait : js.UndefOr [Int ] = js.undefined
1370
+ @ deprecated(" Use maxRetries" , " Node.js v13.3.0, v12.16.0" )
1371
+ var maxBusyTries : js.UndefOr [Int ] = js.undefined
1372
+ var maxRetries : js.UndefOr [Int ] = js.undefined
1373
+ @ deprecated(
1374
+ " Tha option has been removed, and EMFILE errors use the same retry logic as other errors." ,
1375
+ " Node.js v13.3.0, v12.16.0"
1376
+ )
1377
+ var retryDelay : js.UndefOr [Int ] = js.undefined
1329
1378
var recursive : js.UndefOr [Boolean ] = js.undefined
1330
1379
}
1331
1380
0 commit comments