Skip to content

Commit 0dec568

Browse files
ChALkeRMylesBorins
authored andcommitted
fs: remove broken code in promises/write
That code expects the last argument to be a callback. When it's not a callback, it shifts arguments, defaulting encoding to 'utf-8', which is clearly broken. Old signature: (fd, string[, position[, encoding]], callback) New signature: (fd, string[, position[, encoding]]) PR-URL: #20407 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jamie Davis <davisjam@vt.edu> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
1 parent b172f6b commit 0dec568

1 file changed

Lines changed: 0 additions & 9 deletions

File tree

‎lib/internal/fs/promises.js‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,6 @@ async function write(handle, buffer, offset, length, position) {
242242

243243
if(typeofbuffer!=='string')
244244
buffer+='';
245-
if(typeofposition!=='function'){
246-
if(typeofoffset==='function'){
247-
position=offset;
248-
offset=null;
249-
}else{
250-
position=length;
251-
}
252-
length='utf8';
253-
}
254245
constbytesWritten=(awaitbinding.writeString(handle.fd,buffer,offset,
255246
length,kUsePromises))||0;
256247
return{ bytesWritten, buffer };

0 commit comments

Comments
 (0)