I’m trying to find some example code that utilizes node.js, Express, and knox.
The docs for Knox only give clear examples of how to upload a file already stored in the file system. https://github.com/learnboost/knox#readme
Additionally, there a number of simple tutorials (even in Express itself) on how to upload files directly to express and save to the file system.
What I’m having trouble finding is an example that lets you upload a client upload to a node server and have the data streamed directly to S3 rather than storing in the local file system first.
Can someone point me to a gist or other example that contains this kind of information?
All of the previous answers involve having the upload pass through your node.js server which is inefficient and unnecessary. Your node server does not have to handle the bandwidth or processing of uploaded files whatsoever because Amazon S3 allows uploads direct from the browser.
Have a look at this blog post: http://blog.tcs.de/post-file-to-s3-using-node/
I have not tried the code listed there, but having looked over it, it appears solid and I will be attempting an implementation of it shortly ad will update this answer with my findings.