fs: add WriteStream.prototype.flush#28519
Conversation
ea56413 to
030dc39
Compare
bnoordhuis
left a comment
There was a problem hiding this comment.
I appreciate that you took this on but this isn't quite what I had in mind. I tried to explain how it should work but don't hesitate to ask if anything is still unclear.
54db609 to
14a8cf7
Compare
e4a7187 to
45c2b20
Compare
|
WIP |
|
I'm trying to refactor the buffer poll to the task poll, which can solve if write chunk or do fsync |
|
@himself65 Iβm not sure, but maybe #28520 can provide some inspiration? The code ultimately attempts to solve a very similar problem: Integrate flushing operations (and maybe this function here should also be called |
|
so what is the case of example: ws.cork()
ws.write('string')
ws.flush() // or called ws.fsync()
ws.write('string')
ws.uncork()in the current will call |
|
@himself65 Thatβs indeed trickierβ¦ it might be okay to perform the |
b65f54e to
3df464d
Compare
0610606 to
173061f
Compare
| // There is no shutdown() for files. | ||
| WriteStream.prototype.destroySoon = WriteStream.prototype.end; | ||
|
|
||
| WriteStream.prototype._flush = function(cb) { |
There was a problem hiding this comment.
Fwiw, the naming is unfortunate here, but please be aware that the stream _flush() method does something very different than what the idea for fsync() calls is; itβs called just after the last chunk of data has been written, and doesnβt have anything to do with actually flushing data to the underlying resource (itβs not a great name, definitely).
8ae28ff to
2935f72
Compare
|
@himself65 ... still want to do this? Converting the PR to a draft given that it's still a work-in-progress |
fix #28513
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes