From 7f22aaf62b30b84270373d74d6f0f3c2e9f88a48 Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Wed, 9 Oct 2019 12:10:06 -0700 Subject: fs: remove options.encoding from Dir.read*() This is unlikely to be necessary in any case, and causes much unwarrented complexity when implementing further optimizations. Refs: https://github.com/nodejs/node/pull/29893#discussion_r333179482 PR-URL: https://github.com/nodejs/node/pull/29908 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- lib/internal/fs/dir.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lib/internal/fs') diff --git a/lib/internal/fs/dir.js b/lib/internal/fs/dir.js index c1a25f0de3..175c632fc7 100644 --- a/lib/internal/fs/dir.js +++ b/lib/internal/fs/dir.js @@ -48,18 +48,16 @@ class Dir { return this[kDirPath]; } - read(options, callback) { + read(callback) { if (this[kDirClosed] === true) { throw new ERR_DIR_CLOSED(); } - callback = typeof options === 'function' ? options : callback; if (callback === undefined) { - return this[kDirReadPromisified](options); + return this[kDirReadPromisified](); } else if (typeof callback !== 'function') { throw new ERR_INVALID_CALLBACK(callback); } - options = getOptions(options, this[kDirOptions]); const req = new FSReqCallback(); req.oncomplete = (err, result) => { @@ -70,7 +68,7 @@ class Dir { }; this[kDirHandle].read( - options.encoding, + this[kDirOptions].encoding, req ); } @@ -80,11 +78,9 @@ class Dir { throw new ERR_DIR_CLOSED(); } - options = getOptions(options, this[kDirOptions]); - const ctx = { path: this[kDirPath] }; const result = this[kDirHandle].read( - options.encoding, + this[kDirOptions].encoding, undefined, ctx ); -- cgit v1.2.3