Skip to content

WarrenMartin/s3-upload-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S3 multipart upload demo

This small project demonstrates how to upload large video files from a browser into an S3 bucket using multipart uploads and presigned URLs.

Contents:

  • server/ - Express server that creates multipart uploads and returns presigned URLs for parts.
  • frontend/ - Simple HTML + JS UI that chunks files and uploads parts in parallel.

Requirements

  • Node 16+ (or a recent LTS)
  • An existing S3 bucket you can write to

Environment Create a .env file in the project root with these variables:

AWS_ACCESS_KEY_ID=YOUR_KEY
AWS_SECRET_ACCESS_KEY=YOUR_SECRET
AWS_REGION=us-east-1
BUCKET_NAME=your-target-bucket
PORT=3000

How it works

  • Browser: splits each file into ~8 MiB parts, requests a presigned PUT URL per part from the server, uploads parts directly to S3, then calls server to complete the multipart upload.
  • Server: uses AWS SDK v3 to create multipart uploads, generate presigned URLs for UploadPart, and complete multipart uploads.

Run locally

  1. Install deps
cd ~/Desktop/s3-multipart-upload
npm install
  1. Start the server
npm start
  1. Open frontend/index.html in the browser (file://) or serve it with a static server. Set the backend URL to http://localhost:3000 and pick files to upload.

Notes & next steps

  • This example does not implement resume across page reloads or long-term tracking of incomplete uploads. For resumes you should persist uploadId and uploaded parts metadata.
  • You may want to implement an abort endpoint to cleanup unfinished uploads.
  • Adjust PART_SIZE in frontend/main.js for different chunk sizes (must be >= 5 MiB except last part).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors