Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0dec568

Browse filesBrowse 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
Copy full SHA for 0dec568

File tree

Expand file treeCollapse file tree

1 file changed

+0
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+0
-9
lines changed
Open diff view settings
Collapse file

‎lib/internal/fs/promises.js‎

Copy file name to clipboardExpand all lines: lib/internal/fs/promises.js
-9Lines 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 (typeof buffer !== 'string')
244244
buffer += '';
245-
if (typeof position !== 'function') {
246-
if (typeof offset === 'function') {
247-
position = offset;
248-
offset = null;
249-
} else {
250-
position = length;
251-
}
252-
length = 'utf8';
253-
}
254245
const bytesWritten = (await binding.writeString(handle.fd, buffer, offset,
255246
length, kUsePromises)) || 0;
256247
return { bytesWritten, buffer };

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.