SDE & MLE Prep

Handling Large Files (Blobs)

When: uploads/downloads of images, video, documents, backups — anything bigger than a few MB.

  • Never stream large files through your app servers. The API issues a pre-signed URL; the client uploads directly to object storage (S3/GCS) and downloads come from a CDN.
  • Multipart / resumable upload: split into chunks (5–100 MB), upload in parallel, retry only failed parts, then "complete" the upload.
  • Keep metadata (owner, size, checksum, status, storage key) in a database; the blob store holds bytes. Status goes pending → uploaded → processed via the object-store event notification.
  • Content-addressed chunks (key = SHA-256 of the chunk) give dedupe and delta sync (Dropbox).
  • Post-processing (thumbnails, transcoding, virus scanning) runs asynchronously off the upload event.
  • Security: short-lived signed URLs scoped to one key and method; validate type/size after upload.