@@ -7,7 +7,7 @@ import io.scalajs.nodejs.events.IEventEmitter
7
7
8
8
import scala .scalajs .js
9
9
import scala .scalajs .js .annotation .JSImport
10
- import scala .scalajs .js .typedarray .{ ArrayBufferView , Uint8Array }
10
+ import scala .scalajs .js .typedarray
11
11
import scala .scalajs .js .|
12
12
13
13
/**
@@ -456,10 +456,10 @@ trait Fs extends IEventEmitter with FSConstants {
456
456
* @param path the path
457
457
* @param mode the mode
458
458
*/
459
- def mkdirSync (path : Buffer | String , mode : FileMode = js.native): Unit = js.native
459
+ def mkdirSync (path : Path , mode : FileMode = js.native): Unit = js.native
460
460
461
461
@ enableIf(io.scalajs.nodejs.internal.CompilerSwitches .gteNodeJs10)
462
- def mkdirSync (path : Buffer | String , mode : MkdirOptions ): Unit = js.native
462
+ def mkdirSync (path : Path , mode : MkdirOptions ): Unit = js.native
463
463
464
464
/**
465
465
* Creates a unique temporary directory.
@@ -729,7 +729,7 @@ trait Fs extends IEventEmitter with FSConstants {
729
729
* @return the symbolic link's string value.
730
730
*/
731
731
def readlinkSync (path : Path , options : String | FileEncodingOptions ): Output = js.native
732
- def readlinkSync (path : Path ): Output = js.native
732
+ def readlinkSync (path : Path ): String = js.native
733
733
734
734
/**
735
735
* Asynchronous realpath(2).
@@ -980,7 +980,7 @@ trait Fs extends IEventEmitter with FSConstants {
980
980
* @param options the [[FSWatcherOptions optional settings ]]
981
981
* @param listener the callback
982
982
*/
983
- def watchFile (filename : Path , options : FileWatcherOptions , listener : FsCallback2 [Stats , Stats ]): Unit =
983
+ def watchFile (filename : Path , options : FileWatcherOptions , listener : js. Function2 [Stats , Stats , Any ]): Unit =
984
984
js.native
985
985
986
986
/**
@@ -993,7 +993,7 @@ trait Fs extends IEventEmitter with FSConstants {
993
993
* @param filename the filename (Buffer | String)
994
994
* @param listener the callback
995
995
*/
996
- def watchFile (filename : Buffer | String , listener : FsCallback2 [Stats , Stats ]): Unit = js.native
996
+ def watchFile (filename : Path , listener : js. Function2 [Stats , Stats , Any ]): Unit = js.native
997
997
998
998
/**
999
999
* Write buffer to the file specified by fd.
@@ -1013,7 +1013,7 @@ trait Fs extends IEventEmitter with FSConstants {
1013
1013
* @example {{{ fs.write(fd, buffer[, offset[, length[, position]]], callback) }}}
1014
1014
**/
1015
1015
def write (fd : FileDescriptor ,
1016
- buffer : Uint8Array ,
1016
+ buffer : typedarray. Uint8Array ,
1017
1017
offset : Int | Null ,
1018
1018
length : Int | Null ,
1019
1019
position : Int | Null ,
@@ -1049,19 +1049,18 @@ trait Fs extends IEventEmitter with FSConstants {
1049
1049
string : String ,
1050
1050
position : Int ,
1051
1051
encoding : String ,
1052
- callback : FsCallback2 [Int , String ]): Unit = js.native
1053
- def write (fd : FileDescriptor , string : String , position : Int , callback : FsCallback2 [Int , String ]): Unit = js.native
1054
- def write (fd : FileDescriptor , string : String , encoding : String , callback : FsCallback2 [Int , String ]): Unit = js.native
1055
- def write (fd : FileDescriptor , string : String , callback : FsCallback2 [Int , String ]): Unit = js.native
1052
+ callback : FsCallback2 [Int , String ]): Unit = js.native
1053
+ def write (fd : FileDescriptor , string : String , position : Int , callback : FsCallback2 [Int , String ]): Unit = js.native
1054
+ def write (fd : FileDescriptor , string : String , callback : FsCallback2 [Int , String ]): Unit = js.native
1056
1055
1057
1056
/**
1058
1057
* Asynchronously writes data to a file, replacing the file if it already exists. data can be a string or a buffer.
1059
1058
* The encoding option is ignored if data is a buffer. It defaults to 'utf8'
1060
1059
* @example fs.writeFile(file, data[, options], callback)
1061
1060
*/
1062
- def writeFile (file : String , data : Uint8Array , options : FileWriteOptions , callback : FsCallback0 ): Unit =
1061
+ def writeFile (file : String , data : typedarray. Uint8Array , options : FileWriteOptions , callback : FsCallback0 ): Unit =
1063
1062
js.native
1064
- def writeFile (file : String , data : Uint8Array , callback : FsCallback0 ): Unit = js.native
1063
+ def writeFile (file : String , data : typedarray. Uint8Array , callback : FsCallback0 ): Unit = js.native
1065
1064
def writeFile (file : String , data : String , options : FileWriteOptions , callback : FsCallback0 ): Unit =
1066
1065
js.native
1067
1066
def writeFile (file : String , data : String , callback : FsCallback0 ): Unit = js.native
@@ -1076,7 +1075,9 @@ trait Fs extends IEventEmitter with FSConstants {
1076
1075
* @return undefined.
1077
1076
* @example fs.writeFileSync(file, data[, options])
1078
1077
*/
1079
- def writeFileSync (file : Path | FileDescriptor , data : Uint8Array , options : FileWriteOptions = js.native): Unit =
1078
+ def writeFileSync (file : Path | FileDescriptor ,
1079
+ data : typedarray.Uint8Array ,
1080
+ options : FileWriteOptions = js.native): Unit =
1080
1081
js.native
1081
1082
def writeFileSync (file : Path | FileDescriptor , data : String , options : FileWriteOptions ): Unit =
1082
1083
js.native
@@ -1097,10 +1098,14 @@ trait Fs extends IEventEmitter with FSConstants {
1097
1098
* @param position refers to the offset from the beginning of the file where this data should be written.
1098
1099
* @example {{{ fs.writeSync(fd, buffer[, offset[, length[, position]]]) }}}
1099
1100
*/
1100
- def writeSync (fd : FileDescriptor , buffer : Uint8Array , offset : Int , length : Int , position : Int = js.native): Unit =
1101
+ def writeSync (fd : FileDescriptor ,
1102
+ buffer : typedarray.Uint8Array ,
1103
+ offset : Int ,
1104
+ length : Int ,
1105
+ position : Int = js.native): Unit =
1101
1106
js.native
1102
- def writeSync (fd : FileDescriptor , buffer : Uint8Array , offset : Int ): Unit = js.native
1103
- def writeSync (fd : FileDescriptor , buffer : Uint8Array ): Unit = js.native
1107
+ def writeSync (fd : FileDescriptor , buffer : typedarray. Uint8Array , offset : Int ): Unit = js.native
1108
+ def writeSync (fd : FileDescriptor , buffer : typedarray. Uint8Array ): Unit = js.native
1104
1109
def writeSync (fd : FileDescriptor , buffer : BufferLike , offset : Int , length : Int , position : Int ): Unit = js.native
1105
1110
def writeSync (fd : FileDescriptor , buffer : BufferLike , offset : Int , length : Int ): Unit = js.native
1106
1111
def writeSync (fd : FileDescriptor , buffer : BufferLike , offset : Int ): Unit = js.native
@@ -1119,11 +1124,14 @@ trait Fs extends IEventEmitter with FSConstants {
1119
1124
def writeSync (fd : FileDescriptor , data : String , encoding : String ): Unit = js.native
1120
1125
def writeSync (fd : FileDescriptor , data : String ): Unit = js.native
1121
1126
1127
+ @ enableIf(io.scalajs.nodejs.internal.CompilerSwitches .gteNodeJs12)
1122
1128
def writev (fd : FileDescriptor ,
1123
- buffers : js.Array [ArrayBufferView ],
1129
+ buffers : js.Array [typedarray. ArrayBufferView ],
1124
1130
position : Int ,
1125
- fsCallback2 : FsCallback2 [Int , js.Array [ArrayBufferView ]]): Unit = js.native
1126
- def writevSync (fd : FileDescriptor , buffers : js.Array [ArrayBufferView ], position : Int = js.native): Unit = js.native
1131
+ fsCallback2 : FsCallback2 [Int , js.Array [typedarray.ArrayBufferView ]]): Unit = js.native
1132
+ @ enableIf(io.scalajs.nodejs.internal.CompilerSwitches .gteNodeJs12)
1133
+ def writevSync (fd : FileDescriptor , buffers : js.Array [typedarray.ArrayBufferView ], position : Int = js.native): Unit =
1134
+ js.native
1127
1135
}
1128
1136
1129
1137
/**
@@ -1295,6 +1303,7 @@ class RmdirOptions(var emfileWait: js.UndefOr[Int] = 1000,
1295
1303
1296
1304
@ js.native
1297
1305
trait RealpathObject extends js.Object {
1298
- def native (path : Path , options : FileEncodingOptions = js.native): Output = js.native
1299
- def native (path : Path , encoding : String ): String = js.native
1306
+ def native (path : Path , options : FileEncodingOptions , callback : FsCallback1 [Output ]): Unit = js.native
1307
+ def native (path : Path , encoding : String , callback : FsCallback1 [Output ]): Unit = js.native
1308
+ def native (path : Path , callback : FsCallback1 [String ]): Unit = js.native
1300
1309
}
0 commit comments