Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
stream: linting
  • Loading branch information
mmomtchev committed Dec 2, 2020
commit ea37dd7cc2ae106a8b701e59e032aaf2f5732963
9 changes: 5 additions & 4 deletions lib/internal/fs/streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ const { deprecate } = require('internal/util');
const { validateInteger } = require('internal/validators');
const { errorOrDestroy } = require('internal/streams/destroy');
const fs = require('fs');
const { kRef, kUnref } = require('internal/fs/promises');
const { kRef, kUnref, FileHandle } = require('internal/fs/promises');
const { Buffer } = require('buffer');
const {
copyObject,
getOptions,
} = require('internal/fs/utils');
const { Readable, Writable, finished } = require('stream');
const { FileHandle } = require('internal/fs/promises');
const { toPathIfFileURL } = require('internal/url');
const kIoDone = Symbol('kIoDone');
const kIsPerformingIO = Symbol('kIsPerformingIO');
Expand Down Expand Up @@ -124,7 +123,8 @@ function importFd(stream, options) {
// another one
// https://github.com/nodejs/node/issues/35862
stream.fd = options.fd;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
stream.fd = options.fd;
this.fd = options.fd;

} else if (typeof options.fd === 'object' && options.fd instanceof FileHandle) {
} else if (typeof options.fd === 'object' &&
options.fd instanceof FileHandle) {
// When fd is a FileHandle we can listen for 'close' events
if (options.fs)
// FileHandle is not supported with custom fs operations
Expand All @@ -135,7 +135,8 @@ function importFd(stream, options) {
stream[kHandle][kRef]();
options.fd.on('close', FunctionPrototypeBind(stream.close, stream));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
options.fd.on('close', FunctionPrototypeBind(stream.close, stream));
options.fd.on('close', FunctionPrototypeBind(this.close, this));

} else
throw ERR_INVALID_ARG_TYPE('options.fd', ['number', 'FileHandle'], options.fd);
throw ERR_INVALID_ARG_TYPE('options.fd',
['number', 'FileHandle'], options.fd);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
} else {
this.fd = null;
}

}

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-fs-promises-file-handle-read.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ let useConf = false;
.then(validateLargeRead)
.then(common.mustCall());
}
})();
})().then(common.mustCall());