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.

Activity

added
bugIndicates a reported issue or malfunction that needs fixing.
on Jan 20, 2025
added a commit that references this issue on May 4, 2025

#353 Add streaming for FormData

linked a pull request that will close this issue#353: Add streaming for FormData #380on May 4, 2025
added 2 commits that reference this issue on May 29, 2025

#353 Add streaming for FormData

#353 Add streaming for FormData

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      Participants

      @Lunatic174@MrRefactoring

      Issue actions

        Possible memory issue with uploading large files using streams · Issue #353 · MrRefactoring/jira.js