Resumable upload
Imagine that you are uploading a large video file to a video hosting owned by government. The upload process takes a long time, and suddenly, your network connection or the server goes down (the second one is more likely). You have to start the upload process from the beginning, which is frustrating and time-consuming.
As a developer, what can you do to prevent this bad experience?
One solution is to use resumable uploads. Resumable uploads allow you to resume an upload operation after a network interruption or other transmission failure, saving time and bandwidth in the event of network failures. This lesson will introduce you to resumable uploads and explain how they can be implemented in an upload system.
Resumable upload is useful in any of the following cases:
- You are uploading large files.
- The possibility of a network interruption is high.
- Your client who sends the data may have a low-bandwidth or unstable Internet connection.
- You want to be able to pause and resume the upload within a window of time.
In the following lessons, I will be sharing some of my notes while trying to implement simple resumable upload. In fact, resumable upload can be implemented in various ways. If you take a look into Youtube Resumable Upload guide you will see from their API how youtube design their resumable upload system. I will highly recommend you to read the guide as it provides a good insight on how to design a resumable upload system.
I am using the Tus resumable upload protocol as my guideline. Tus is an open protocol for resumable file uploads built on HTTP. It allows you to resume an upload operation after a network interruption or other transmission failure, saving time and bandwidth in the event of network failures.