Skip to content

an example of streaming multipart uploads directly to s3, displaying a real-time progress bar

Notifications You must be signed in to change notification settings

cantlin/node-s3-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This is an example of using formidable, knox and socket.io to create a file uploader with the following features:

  • Pipes incoming data directly to s3 without saving it to the file system.
  • Reports accurate real time progress to the browser, allowing for a progress bar everywhere including IE6.

Install

$ cd /path/to/repo
$ npm install
$ mkdir conf

Create a conf/default.yaml and make it look like this:

s3:
    key: <key>
    secret: <secret>
    bucket: <bucket>
    endpoint: <endpoint>

Then run node app and navigate to localhost:8080.

Notes

In IE<10, the file has to be saved to the file system temporarily before it is uploaded. This is because we can't know the Content-Length of the uploaded file until we have seen the entire request. As a result the progress bar won't account for the time taken for the server to upload to s3.

The asynchronous upload uses an iframe in preference to the File API. Assuming you're reporting progress by other means (as we are here), there's no reason I can discern to have another code path for the more modern browsers.

About

an example of streaming multipart uploads directly to s3, displaying a real-time progress bar

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages