Resumable Uploads

Introduction

For larger files, we recommend using resumable uploads.

This breaks the file into chunks and sends them to the server separately.

It means you can send chunks in parallel, and if one chunk fails, you can retry that chunk without having to restart the whole upload.

How it works

Just add a header covering the byte range that is being sent.

For example, to send the first 16MB of a 100MB file:

fetch('https://you.ittybit.net/new-filename.webp?expiry=17150000&signature=aaaaaaaaaaaaaaaa==',{
  method: 'PUT',
  headers: {
    'Content-Range': 'bytes=0-16777216/100000000'
  },
  body: chunk,
});
// Returns
202 Accepted

If it's the final chunk, we check that we have all the chunks and process the full file:

fetch('https://you.ittybit.net/new-filename.webp?expiry=17150000&signature=aaaaaaaaaaaaaaaa==',{
  method: 'PUT',
  headers: {
    'Content-Range': 'bytes=83886080-99999999/100000000'
  },
  body: chunk,
});
// Returns
201 Created

{
  "id": "file_abcdefgh1234",
  "media_id": "med_abcdefgh1234",
  "type": "video/mp4",
  "width": 1280,
  "height": 720,
  "filesize": 12345678,
  "duration": 2.0,
  "frames": 50,
  "fps": 25,
  "url": "https://you.ittybit.net/new-filename.webp",
  "status": "ready",
  "created": "2024-01-01Z10:10:10.1010",
  "version": "171450000"
}

Then any subsequent GET requests to the deliver url will return the uploaded file

GET "https://you.ittybit.net/new-filename.webp"

```json
// Returns
200 OK
Content-Type: "video/mp4"
Content-Length: 100000000

(video data)

On this page