Skip to content

stream: add FileHandle support to Read/WriteStream - #35922

Closed
mmomtchev wants to merge 20 commits into
nodejs:masterfrom
mmomtchev:stream-filehandle
Closed

stream: add FileHandle support to Read/WriteStream#35922
mmomtchev wants to merge 20 commits into
nodejs:masterfrom
mmomtchev:stream-filehandle

Conversation

@mmomtchev

Copy link
Copy Markdown
Contributor

Support creating a Read/WriteStream from a
FileHandle instead of a raw file descriptor
Add an EventEmitter to FileHandle with a single
'close' event

Refs: #35240

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added the fs Issues and PRs related to the fs subsystem / file system. label Nov 2, 2020
Comment threaddoc/api/fs.md Outdated
@aduh95aduh95 added the semver-minor PRs that contain new features and should be released in the next minor version. label Nov 2, 2020

@aduh95aduh95 left a comment

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.

I've made a few suggestions to use primordials when possible, PTAL.

Comment threadlib/internal/fs/promises.js Outdated
Comment threadlib/internal/fs/streams.js Outdated
Comment threadlib/internal/fs/promises.js Outdated
Comment threadlib/internal/fs/streams.js Outdated
Comment threadlib/internal/fs/streams.js Outdated
Comment threadlib/internal/fs/streams.js Outdated
Comment threadlib/internal/fs/streams.js Outdated
Comment threadlib/internal/fs/promises.js Outdated
Comment threadlib/internal/fs/promises.js Outdated
Comment threadlib/internal/fs/streams.js Outdated
@benjamingr

Copy link
Copy Markdown
Member

Our file handles are pretty huge anyway and I am not thrilled about adding all those extra properties to them, I don't really understand the use case :/

I'm -0 but won't block

(good job on the actual changes, the code itself looks good 👍 ).

@mmomtchev

Copy link
Copy Markdown
ContributorAuthor

Our file handles are pretty huge anyway and I am not thrilled about adding all those extra properties to them, I don't really understand the use case :/

I'm -0 but won't block

(good job on the actual changes, the code itself looks good ).

#35862 - this is the use case

Comment threadlib/internal/fs/promises.js Outdated
Comment threadlib/internal/fs/streams.js Outdated
Comment threadlib/internal/fs/streams.js Outdated
Comment threadlib/internal/fs/promises.js Outdated
Comment threadlib/internal/fs/promises.js Outdated
Comment threadlib/events.js Outdated
Comment threadlib/events.js Outdated
Comment threadlib/events.js Outdated
Comment threadlib/events.js Outdated
Comment threadlib/internal/fs/promises.js Outdated

@addaleaxaddaleax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice work :)

Comment threadtest/parallel/test-fs-write-stream-file-handle.js Outdated
Comment threadlib/internal/event_target.js Outdated
Comment threadlib/events.js Outdated
Comment threaddoc/api/fs.md Outdated
@Trott

Copy link
Copy Markdown
Member

(Needs a rebase.)

mmomtchevand others added 5 commits December 2, 2020 18:50
fix flaky test, tmpdir should be refreshed only
in the main thread
Apply suggestions from code review
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@aduh95aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Dec 2, 2020
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 2, 2020
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95

Copy link
Copy Markdown
Contributor

Landed in 0fd121e

@aduh95aduh95 closed this Dec 4, 2020
aduh95 pushed a commit that referenced this pull request Dec 4, 2020
Support creating a Read/WriteStream from a
FileHandle instead of a raw file descriptor
Add an EventEmitter to FileHandle with a single
'close' event.
Fixes: #35240
PR-URL: #35922
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@ronag

This comment has been minimized.

@mmomtchev

Copy link
Copy Markdown
ContributorAuthor

@ronag I don't see it? What is the function sequence?

@ronag

ronag commented Dec 6, 2020

Copy link
Copy Markdown
Member

@mmomtchev you are right. There is no problem here.

@aduh95aduh95 mentioned this pull request Dec 6, 2020
2 tasks
danielleadams pushed a commit that referenced this pull request Dec 7, 2020
Support creating a Read/WriteStream from a
FileHandle instead of a raw file descriptor
Add an EventEmitter to FileHandle with a single
'close' event.
Fixes: #35240
PR-URL: #35922
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@danielleadamsdanielleadams mentioned this pull request Dec 7, 2020
danielleadams added a commit that referenced this pull request Dec 7, 2020
PR-URL: #36435
Notable changes:
* child_processes:
* add AbortSignal support (Benjamin Gruenbaum) (#36308)
* deps:
* update ICU to 68.1 (Michaël Zasso) (#36187)
* events:
* support signal in EventTarget (Benjamin Gruenbaum) (#36258)
* graduate Event, EventTarget, AbortController (James M Snell) (#35949)
* http:
* enable call chaining with setHeader() (pooja d.p) (#35924)
* module:
* add isPreloading indicator (James M Snell) (#36263)
* stream:
* support abort signal (Benjamin Gruenbaum) (#36061)
* add FileHandle support to Read/WriteStream (Momtchil Momtchev) (#35922)
* worker:
* add experimental BroadcastChannel (James M Snell) (#36271)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.fsIssues and PRs related to the fs subsystem / file system.semver-minorPRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@mmomtchev@benjamingr@Trott@nodejs-github-bot@aduh95@addaleax@ronag@richardlau@targos