Skip to content
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

Note how to defer file descriptor creation/use a stream Ctor #454

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bcomnes
Copy link

@bcomnes bcomnes commented Feb 10, 2020

When appending many files and creating readstreams for each one, you run the real risk of blowing you file descriptor limit. Generally its better to defer the creation of readStreams until you need to read the file.

Reading into the combined stream docs, it appeared that this would support the (next) => next(fs.createReadStream('foo')) api, however its not quite that simple. This module expects a path property on the value so I documented that expectation.

There is probably room for improvement here, API wise, however this should help assist people from having to read too much code to achieve this outcome.

Thank you for and open to any suggestions.

When appending many files and creating readstreams for each one, you run the real risk of blowing you file descriptor limit.  Generally its better to defer the creation of readStreams until you need to read the file.  

Reading into the combined stream docs, it appeared that this would support the `(next) => next(fs.createReadStream('foo')` api, however its not quite that simple.  This module expects a `path` property on the value so I documented that expectation.  

There is probably room for improvement here, API wise, however this should help assist people from having to read too much code to achieve this outcome. 

Thank you for and open to any suggestions.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.174% when pulling 9abbbdc on bcomnes:patch-1 into d702625 on form-data:master.

@bcomnes bcomnes changed the title Note how to defer file descriptor creation Note how to defer file descriptor creation/use a stream Ctor Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants