Description
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.