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

Is it necessary to create memory streams instead of buffers to cache large files? #1

Closed
turone opened this issue Jul 14, 2023 · 0 comments

Comments

@turone
Copy link

turone commented Jul 14, 2023

https://github.com/HowProgrammingWorks/ServeStatic/blob/f170cd47c3c73689dc6bbaca9d58fea0bc31b33f/JavaScript/3-cache/server.js#L49C16-L49C16
In the lecture, you said that when there is a large file in the buffer, then returning it via "res.end(data)" will block the reception or processing of new requests from the client.
Then the question arises: is it enough to simply send the buffer through "res.write(data)" or is it necessary to create memory streams and then output them through "data.pipe(res)"?
https://youtu.be/n_AdKIzbpBc?list=LL&t=1934

@turone turone closed this as completed Jul 21, 2023
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

No branches or pull requests

1 participant