Skip to content

Possible memory issue with uploading large files using streams #353

Open
@Lunatic174

Description

@Lunatic174

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates a reported issue or malfunction that needs fixing.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions