My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Node.js: How to transfer uploaded file directly to S3 without double waiting time?

Siraj abbas's photo
Siraj abbas
·Feb 2, 2017

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?