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

Possible memory issue with uploading large files using streams #353

Open
Lunatic174 opened this issue Jan 15, 2025 · 0 comments
Open

Possible memory issue with uploading large files using streams #353

Lunatic174 opened this issue Jan 15, 2025 · 0 comments

Comments

@Lunatic174
Copy link

Problem Description

In version 4.0.6 of the jira.js library, uploading large files using ReadableStream has become less optimal due to increased memory consumption. The current implementation converts the stream into a Blob or File, which requires the entire file to be loaded into memory before it can be sent as a form attachment. Previously, with form-data, streaming files directly was supported without this intermediate step, avoiding unnecessary memory overhead.

Issue

The current implementation of the _streamToBlob method involves loading the entire file into memory (via Uint8Array[]) to construct a Blob. This approach is inefficient and can potentially cause the process to crash for large files.

With form-data, it was possible to append a Readable stream directly to FormData, which eliminated the need for loading the entire file into memory. However, formdata-node does not natively support this feature. That said, the maintainers of formdata-node provide examples (examples №8 and №9) for working with streams in the new version, which might help address this issue.

Open to Discussion

If there's a better or more efficient way to handle this use case, I would be happy to learn and discuss potential solutions.

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