diff --git a/lib/internal/fs/streams.js b/lib/internal/fs/streams.js index 4a8c0046761cd5..c52d58032d210b 100644 --- a/lib/internal/fs/streams.js +++ b/lib/internal/fs/streams.js @@ -20,7 +20,7 @@ const { Buffer } = require('buffer'); const { copyObject, getOptions, - validatePath + validatePath, } = require('internal/fs/utils'); const { Readable, Writable, finished } = require('stream'); const { toPathIfFileURL } = require('internal/url'); @@ -134,7 +134,7 @@ function ReadStream(path, options) { // If fd has been set, validate, otherwise validate path. if (this.fd != null) { - validateInteger(this.fd, 'fd', 0); + this.fd = getValidatedFd(this.fd); } else { validatePath(this.path); } @@ -306,7 +306,7 @@ function WriteStream(path, options) { // If fd has been set, validate, otherwise validate path. if (this.fd != null) { - validateInteger(this.fd, 'fd', 0); + this.fd = getValidatedFd(this.fd); } else { validatePath(this.path); }