Repository navigation
stream: add FileHandle support to Read/WriteStream #35922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
72873cf
stream: add FileHandle support to Read/WriteStream
mmomtchev 51640a5
stream: support FileHandle in Read/WriteStream
mmomtchev 4a841ac
stream: Add FileHandle support to Read/WriteStream
mmomtchev 6662fb3
stream: support FileHandle for Read/WriteStream
mmomtchev 7713743
stream: support FileHandle for Read/WriteStream
mmomtchev d43eb37
stream: support FileHandle for Read/WriteStream
mmomtchev e6eba34
stream: Support FileHandle in Read/WriteStream
mmomtchev 7495c24
stream: Support FileHandle in Read/WriteStream
mmomtchev be4dc0b
stream: support FileHandle in Read/WriteStream
mmomtchev b9c8218
fs: add FileHandle support to Read/WriteStream
mmomtchev bb8f483
fs: add FileHandle support to Read/WriteStream
mmomtchev 9506ec8
fs: support for FileHandle in Read/WriteStream
mmomtchev cb0c20c
stream: remove duplicate EventTarget after rebase
mmomtchev 96d0198
stream: actually run the unit test
mmomtchev 7095132
stream: throw on invalid args
mmomtchev ea37dd7
stream: linting
mmomtchev 403a7aa
stream: remove useless initializiation of stream.fd
mmomtchev c267bc1
stream: create tmpdir only in main thread
mmomtchev 68f98fb
Remove useless `/` from path.join
mmomtchev 8d0a717
stream: compatibility with the --work test
mmomtchev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
stream: linting
- Loading branch information
commit ea37dd7cc2ae106a8b701e59e032aaf2f5732963
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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'); | ||||||||||
|
|
@@ -124,7 +123,8 @@ function importFd(stream, options) { | |||||||||
| // another one | ||||||||||
| // https://github.com/nodejs/node/issues/35862 | ||||||||||
| stream.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 | ||||||||||
|
|
@@ -135,7 +135,8 @@ function importFd(stream, options) { | |||||||||
| stream[kHandle][kRef](); | ||||||||||
| options.fd.on('close', FunctionPrototypeBind(stream.close, stream)); | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| } else | ||||||||||
| throw ERR_INVALID_ARG_TYPE('options.fd', ['number', 'FileHandle'], options.fd); | ||||||||||
| throw ERR_INVALID_ARG_TYPE('options.fd', | ||||||||||
| ['number', 'FileHandle'], options.fd); | ||||||||||
| } | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,4 +71,4 @@ let useConf = false; | |
| .then(validateLargeRead) | ||
| .then(common.mustCall()); | ||
| } | ||
| })(); | ||
| })().then(common.mustCall()); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.