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

Use small chunks with toStream() #44

Closed
huan opened this issue Oct 27, 2020 · 0 comments · Fixed by #45
Closed

Use small chunks with toStream() #44

huan opened this issue Oct 27, 2020 · 0 comments · Fixed by #45
Labels
enhancement New feature or request

Comments

@huan
Copy link
Owner

huan commented Oct 27, 2020

Write a big chunk to stream will cause problems like block event loop

Especially here:

file-box/src/file-box.ts

Lines 492 to 495 in cf6caf5

private transformBufferToStream (buffer?: Buffer): Readable {
const bufferStream = new PassThrough()
bufferStream.end(buffer || this.buffer)
return bufferStream

Here's a solution: ChunkerTransformStream, a transform stream to take arbitrary chunk sizes and make them consistent

CC: @windmemory

@huan huan added the enhancement New feature or request label Oct 27, 2020
huan added a commit that referenced this issue Oct 27, 2020
@huan huan closed this as completed in #45 Oct 27, 2020
huan added a commit that referenced this issue Oct 27, 2020
add chunker transform stream (#44)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant