@@ -1220,9 +1220,9 @@ function futimesSync(fd, atime, mtime) {
1220
1220
handleErrorFromBinding ( ctx ) ;
1221
1221
}
1222
1222
1223
- function writeAll ( fd , isUserFd , buffer , offset , length , position , callback ) {
1223
+ function writeAll ( fd , isUserFd , buffer , offset , length , callback ) {
1224
1224
// write(fd, buffer, offset, length, position, callback)
1225
- fs . write ( fd , buffer , offset , length , position , ( writeErr , written ) => {
1225
+ fs . write ( fd , buffer , offset , length , null , ( writeErr , written ) => {
1226
1226
if ( writeErr ) {
1227
1227
if ( isUserFd ) {
1228
1228
callback ( writeErr ) ;
@@ -1240,10 +1240,7 @@ function writeAll(fd, isUserFd, buffer, offset, length, position, callback) {
1240
1240
} else {
1241
1241
offset += written ;
1242
1242
length -= written ;
1243
- if ( position !== null ) {
1244
- position += written ;
1245
- }
1246
- writeAll ( fd , isUserFd , buffer , offset , length , position , callback ) ;
1243
+ writeAll ( fd , isUserFd , buffer , offset , length , callback ) ;
1247
1244
}
1248
1245
} ) ;
1249
1246
}
@@ -1269,9 +1266,8 @@ function writeFile(path, data, options, callback) {
1269
1266
function writeFd ( fd , isUserFd ) {
1270
1267
const buffer = isArrayBufferView ( data ) ?
1271
1268
data : Buffer . from ( '' + data , options . encoding || 'utf8' ) ;
1272
- const position = ( / a / . test ( flag ) || isUserFd ) ? null : 0 ;
1273
1269
1274
- writeAll ( fd , isUserFd , buffer , 0 , buffer . byteLength , position , callback ) ;
1270
+ writeAll ( fd , isUserFd , buffer , 0 , buffer . byteLength , callback ) ;
1275
1271
}
1276
1272
}
1277
1273
@@ -1287,15 +1283,11 @@ function writeFileSync(path, data, options) {
1287
1283
}
1288
1284
let offset = 0 ;
1289
1285
let length = data . byteLength ;
1290
- let position = ( / a / . test ( flag ) || isUserFd ) ? null : 0 ;
1291
1286
try {
1292
1287
while ( length > 0 ) {
1293
- const written = fs . writeSync ( fd , data , offset , length , position ) ;
1288
+ const written = fs . writeSync ( fd , data , offset , length ) ;
1294
1289
offset += written ;
1295
1290
length -= written ;
1296
- if ( position !== null ) {
1297
- position += written ;
1298
- }
1299
1291
}
1300
1292
} finally {
1301
1293
if ( ! isUserFd ) fs . closeSync ( fd ) ;
0 commit comments