Hi i am developing REST api's for mobile application in which user uploads images to app server then server uploads images to amazon s3 and update the database.
The problem:
1.User wants to upload 10MB file It takes 10 seconds to travel from user's device to my server
2.After server has received last bit, it starts uploading to S3. Another 10 seconds.
3.After 20 seconds in total, user is presented with hyperlink.
I think these 20 seconds can be reduced by half, to 12 or so. If Nodejs were smart enough to start uploading to S3 not after the last bit arrived, but after the first bit arrived from user - don't wait for all file to be uploaded, but start streaming on the fly.
Is this possible?
Use mount for transfer the file.
Sandeep Panda
co-founder, Hashnode
Take a look at this article which explains how to upload files to S3 directly without uploading them to your server first. It is Heroku specific, but you will get the overall idea.