aboutsummaryrefslogtreecommitdiff
path: root/lib/internal/fs
diff options
context:
space:
mode:
authorСковорода Никита Андреевич <chalkerx@gmail.com>2018-04-29 20:58:29 +0300
committerСковорода Никита Андреевич <chalkerx@gmail.com>2018-05-08 13:10:39 +0300
commitca6b12e28df53110de7ee58699d5af099d036c67 (patch)
treeb46ef0927baed2a196d219ce85a3142e94044e1d /lib/internal/fs
parentdd03709148ec49b55792a1e29144634a323326b0 (diff)
downloadandroid-node-v8-ca6b12e28df53110de7ee58699d5af099d036c67.tar.gz
android-node-v8-ca6b12e28df53110de7ee58699d5af099d036c67.tar.bz2
android-node-v8-ca6b12e28df53110de7ee58699d5af099d036c67.zip
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: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'lib/internal/fs')
-rw-r--r--lib/internal/fs/promises.js9
1 files changed, 0 insertions, 9 deletions
diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js
index 6b523473e4..eee08d1409 100644
--- a/lib/internal/fs/promises.js
+++ b/lib/internal/fs/promises.js
@@ -244,15 +244,6 @@ async function write(handle, buffer, offset, length, position) {
if (typeof buffer !== 'string')
buffer += '';
- if (typeof position !== 'function') {
- if (typeof offset === 'function') {
- position = offset;
- offset = null;
- } else {
- position = length;
- }
- length = 'utf8';
- }
const bytesWritten = (await binding.writeString(handle.fd, buffer, offset,
length, kUsePromises)) || 0;
return { bytesWritten, buffer };