Skip to content

Commit

Permalink
allow fd to be filehandle in fs.createWriteStream
Browse files Browse the repository at this point in the history
  • Loading branch information
graue committed Nov 28, 2024
1 parent a682b4c commit b426edd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/volume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2260,7 +2260,7 @@ function FsReadStream(vol, path, options) {
Readable.call(this, options);

this.path = pathToFilename(path);
this.fd = options.fd === undefined ? null : options.fd;
this.fd = options.fd === undefined ? null : typeof options.fd !== 'number' ? options.fd.fd : options.fd;
this.flags = options.flags === undefined ? 'r' : options.flags;
this.mode = options.mode === undefined ? 0o666 : options.mode;

Expand Down Expand Up @@ -2429,7 +2429,7 @@ function FsWriteStream(vol, path, options) {
Writable.call(this, options);

this.path = pathToFilename(path);
this.fd = options.fd === undefined ? null : options.fd;
this.fd = options.fd === undefined ? null : typeof options.fd !== 'number' ? options.fd.fd : options.fd;
this.flags = options.flags === undefined ? 'w' : options.flags;
this.mode = options.mode === undefined ? 0o666 : options.mode;

Expand Down

0 comments on commit b426edd

Please sign in to comment.