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

Support container.Put without knowing the item size #214

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

urisimchoni
Copy link
Contributor

Allow passing -1 as item size, which means we don't know the item's size.
Most storage backends don't really care about the size parameter. This PR modifies the local backend to also don't care in case of -1, and adds a test to codify this behavior.

One use case for this is receiving HTTP upload requests (with multipart/form-data payload) and streaming them to a storage server without having to store the entire file in the HTTP server.

@alash3al
Copy link

any updates here ?

When putting an item, the item's data is retrieved from an
io.Reader, but a size argument is also supplied. This change
causes the local backend to ignore the size (as what most other
backends do) if it's negative. This allows for data sources whose
size is not known in advance (e.g. getting an HTTP upload request
with a multipart/form-data payload).
Show that all backends can receive -1 as size for Put.
@urisimchoni
Copy link
Contributor Author

rebased on master

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.

None yet

2 participants