Example of using Sails to properly/safely stream file uploads to S3 and/or disk (esp. really big uploads).
Clone this repo,
npm install, then start the server with
sails lift. Or deploy it on Heroku with:
To download a file from disk, see https://github.com/sails101/file-uploads/blob/master/api/controllers/FileController.js#L82. A request also exists for this on Postman. The built-in action downloads a file from disk at the specified path-- this is purely for grabbing something you just uploaded. In production, you should use a different id (not the
fdof the uploaded file).
To download a file from S3, talk to the Amazon S3 API directly.