tus / tus-java-client

The tus client for Java.
https://tus.io
MIT License
208 stars 85 forks source link

How can I implement concurrent uploading of a large file in Android? #113

Open Alpha-chen opened 2 months ago

Alpha-chen commented 2 months ago

Question How can I implement parallel uploading of a large file in Android?

I have read the article(https://tus.io/protocols/resumable-upload#concatenation), but I'm not sure how to add this header in the code. How can I implement parallel uploading of large files in Android?

Acconut commented 2 months ago

Unlike tus-js-client, the tus-java-client does not have native support for the concatenation extension, so your endeavor would involve a lot of manual work. This means that you would have to split the large file on your own and start a separate, partial tus upload for each part. For each part, you should set Upload-Concat: partial, which can be done by overwriting the prepareConnection method, as is done here for SSL configuration: https://github.com/tus/tus-java-client?tab=readme-ov-file#can-i-use-my-own-custom-sslsocketfactory Once the parts are uploaded, you would have to manually send the final POST request to concatenate the partial uploads together.

All in all, not easy. I hope that we can add native support for this in the future.