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 upload asset with large file size #258

Closed
Steven-Chan opened this Issue Aug 7, 2018 · 0 comments

Comments

Projects
None yet
3 participants
@Steven-Chan
Copy link
Contributor

Steven-Chan commented Aug 7, 2018

The sdk is using volley multipart to upload file, which does not handle large file well. See google/volley#106.

But the sdk can still handle large file better. Currently, an Asset object only accepts byte[] in constructor, which force developer to put the whole file data in memory.

To solve this problem, Asset should also accept being constructed with input stream / uri with a content resolver.

Case 1: byte[]

  • Asset size = length of the byte array
  • When upload,
    • write the byte array to a temporary file
    • add the file to the multipart request

Case 2: InputStream

  • Asset size = given when the Asset object is constructed
  • When upload,
    • pipe the data from input stream to a temporary file <- unless volley support piping it to the request directly
    • add the file to the multipart request

Case 3: Uri with ContentResolver

Get a InputStream using the uri and content resolver when needed.


Update:

InputStream is too low level and we need file size when save asset which is not provided by the stream, we may support Uri (or maybe File and URL later).

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