diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/fs/dir.js | 12 |
1 files changed, 4 insertions, 8 deletions
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 ); |