@@ -1240,9 +1240,9 @@ function futimesSync(fd, atime, mtime) {
1240
1240
handleErrorFromBinding ( ctx ) ;
1241
1241
}
1242
1242
1243
- function writeAll ( fd , isUserFd , buffer , offset , length , position , callback ) {
1243
+ function writeAll ( fd , isUserFd , buffer , offset , length , callback ) {
1244
1244
// write(fd, buffer, offset, length, position, callback)
1245
- fs . write ( fd , buffer , offset , length , position , ( writeErr , written ) => {
1245
+ fs . write ( fd , buffer , offset , length , null , ( writeErr , written ) => {
1246
1246
if ( writeErr ) {
1247
1247
if ( isUserFd ) {
1248
1248
callback ( writeErr ) ;
@@ -1260,10 +1260,7 @@ function writeAll(fd, isUserFd, buffer, offset, length, position, callback) {
1260
1260
} else {
1261
1261
offset += written ;
1262
1262
length -= written ;
1263
- if ( position !== null ) {
1264
- position += written ;
1265
- }
1266
- writeAll ( fd , isUserFd , buffer , offset , length , position , callback ) ;
1263
+ writeAll ( fd , isUserFd , buffer , offset , length , callback ) ;
1267
1264
}
1268
1265
} ) ;
1269
1266
}
@@ -1289,9 +1286,8 @@ function writeFile(path, data, options, callback) {
1289
1286
function writeFd ( fd , isUserFd ) {
1290
1287
const buffer = isArrayBufferView ( data ) ?
1291
1288
data : Buffer . from ( '' + data , options . encoding || 'utf8' ) ;
1292
- const position = ( / a / . test ( flag ) || isUserFd ) ? null : 0 ;
1293
1289
1294
- writeAll ( fd , isUserFd , buffer , 0 , buffer . byteLength , position , callback ) ;
1290
+ writeAll ( fd , isUserFd , buffer , 0 , buffer . byteLength , callback ) ;
1295
1291
}
1296
1292
}
1297
1293
@@ -1307,15 +1303,11 @@ function writeFileSync(path, data, options) {
1307
1303
}
1308
1304
let offset = 0 ;
1309
1305
let length = data . byteLength ;
1310
- let position = ( / a / . test ( flag ) || isUserFd ) ? null : 0 ;
1311
1306
try {
1312
1307
while ( length > 0 ) {
1313
- const written = fs . writeSync ( fd , data , offset , length , position ) ;
1308
+ const written = fs . writeSync ( fd , data , offset , length ) ;
1314
1309
offset += written ;
1315
1310
length -= written ;
1316
- if ( position !== null ) {
1317
- position += written ;
1318
- }
1319
1311
}
1320
1312
} finally {
1321
1313
if ( ! isUserFd ) fs . closeSync ( fd ) ;
0 commit comments