-
-
Notifications
You must be signed in to change notification settings - Fork 37.1k
fs: add WriteStream.prototype.fsync #28513
Copy link
Copy link
Closed
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.fsIssues and PRs related to file-system APIs and the fs module.Issues and PRs related to file-system APIs and the fs module.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
Description
Activity
Metadata
Metadata
Assignees
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.fsIssues and PRs related to file-system APIs and the fs module.Issues and PRs related to file-system APIs and the fs module.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
Right now it's pretty complicated to intermix
fs.fsync()calls withws.write()calls, to the point that you lose most of the benefits of usingfs.WriteStream. Example:It would be exceedingly helpful if
fs.WriteStreamgrew a.fsync()method that preserves order with respect to writes so that the following example works like I would expect it to:It's not quite impossible to accomplish the above today but it's not very ergonomic. Here is an async/await example:
I don't know, the fact that you need to know about the
'open'event doesn't give me warm fuzzies. Proper synchronization is important enough that I feel it merits a place in core.