-
Notifications
You must be signed in to change notification settings - Fork 3
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
S3: getObject response body streaming? #38
Comments
Hey, yes #24 is about request bodies. Comparatively, response bodies have almost no blockers to support streaming. It's just a question of API design. deno-aws_api/lib/services/s3/mod.ts Line 1027 in 3ce25f2
So how should a streaming body be requested and then returned? Is changing Input welcome on how to present streaming response bodies :)
You can also make a pre-signed URL and then immediately fetch that URL from the same process! So you can contain the cloud layout within the server. Still a workaround of course. |
Great point! Worth a try in the meantime. My intuition says that a Looking at api from Node world: SDK v3 S3's SDK V2 buffered the response into memory which introduces same challenges discussed on this issue |
This is looking like the most reasonable answer for a Deno-first library and has great synergy with // different ways of buffering a stream:
const bodyBytes = new Uint8Array(await new Response(resp.Body).arrayBuffer());
const bodyText = await new Response(resp.Body).text();
const bodyJson = await new Response(resp.Body).json(); I'm concerned about discoverability, because it's not obvious to use I'm adding a tsdoc comment on the bodies (and a release note) and call it a day, because /** To get this stream as a buffer, use `new Response(...).arrayBuffer()` or related functions. */
Body?: ReadableStream<Uint8Array> | null; |
🚀 This just shipped in For specific result fields which are the entire contents of the response body, the returned structure will now contain the |
Hey @danopia . Sorry, i've been caught on other things. This looks really cool though, i'm going to give it a try! Thanks for your work on this! |
I see this note on the
getObject
implementation forS3
and I know #24 exists, but seems to be focused on uploading objects, not getting objects. Being able to stream objects down fromS3
would be awesome.My use case:
My S3 buckets are locked down and can't be publicly accessed, so I would like to stream an object from
S3
, through my server, to the client, without needing to buffer the entire object. A workaround would be to create a presigned url for retrieving the object from s3 and the client using that, instead of my server, I just don't like exposing the underlying cloud infra, if that makes sense.The text was updated successfully, but these errors were encountered: