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

Avoid buffering image conversion with streams #449

Merged
merged 1 commit into from
Mar 2, 2022

Conversation

lmammino
Copy link
Contributor

@lmammino lmammino commented Feb 25, 2022

The illustrated solution buffers the thumbnail entirely in memory before starting to send data back to the user.

Description of changes:

The proposed change keeps sharp operating in streaming mode and since writeGetObjectResponse supports a readable stream in the Body property, this approach should start to stream bytes back to the user while the thumbnail is generated.

This should also make the lambda more memory efficient.

@jbesw jbesw merged commit d21251e into aws-samples:main Mar 2, 2022
@jbesw
Copy link
Contributor

jbesw commented Mar 2, 2022

Thanks for the improvement!

@lmammino lmammino deleted the patch-1 branch March 2, 2022 13:08
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

Successfully merging this pull request may close these issues.

2 participants