mike-marcacci / fs-capacitor

Filesystem-bufferred, passthrough stream that buffers indefinitely rather than propagate backpressure from downstream consumers.
MIT License
36 stars 8 forks source link

fix: refactor to node streams #14

Closed ronag closed 5 years ago

ronag commented 5 years ago

Refactors module into node streams. There are some rules that should be followed to maintain compatibility with node streams:

This fixes breakage in Node 13 https://github.com/nodejs/node/issues/30110.

This is potentially breaking.

Fixes a bug where the capacitor could be destroyed before all readables have been destroyed.

Re-use same fd between write and read.

Slightly slower read since it doesn't re-use the pooling logic from ReadStream.

mike-marcacci commented 5 years ago

Hi @ronag,

Thanks so much for opening this and addressing the compatibility issues with node 13. I've skimmed your changes and am very interested in this approach. I will give this a deep dive tomorrow.