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

File Storage API downloadRetrieve method returns ReadableStream #46

Open
pandektes-braedon opened this issue Nov 19, 2024 · 3 comments
Open

Comments

@pandektes-braedon
Copy link

pandektes-braedon commented Nov 19, 2024

Problem

The downloadRetrieve method is typed as returning a Readable node stream:

The api does not return a node stream, it returns a ReadableStream

Steps to Reproduce

    import { PassThrough, Readable } from 'node:stream'

    const readable = await merge.filestorage.files.downloadRetrieve(fileId)

    const isReadable = readable instanceof Readable // returns false
    const isReadableStream = readable instanceof ReadableStream // returns true

Would it be possible to update the API to return a node stream instead of the web stream?

@dsinghvi
Copy link
Collaborator

@pandektes-braedon we'll take a look here, did you notice this after upgrading the SDK to latest?

@pandektes-braedon
Copy link
Author

@dsinghvi I'm currently running v1.0.11. I installed the SDK last week, however, it looks like the api is the same in latest.

Could you also confirm if the file is actually being streamed? Based on current current usage, it looks like your API is buffering the whole file in before returning it to me which defeats the purpose of the stream. I could be wrong but that's currently what it looks like while testing.

@dsinghvi
Copy link
Collaborator

dsinghvi commented Dec 9, 2024

It should be streamed -- i would use the .pipe method to test this

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

2 participants