Monday, 3 April 2017

Upload large files to AWS s3 using express js synchrounsly

Currently i am using putObject to upload the large file to AWS s3 with REST api call.

 var params ={               
     Bucket:'lambdacushbu',    
     Key:req.files.image.name, 
     Body:req.files.image.data 
 }                             
  s3.putObject(params,function(err, data) {                      
      if (err) console.log(err, err.stack); // an error occurred      
      else     {                                                      
          console.timeEnd('Uploadtime');                              
          console.log("uploaded",data);                               
          res.json({                                                  
              'status':'Uploaded',                                    
              'url':data.Location                                     
          });                                                         
      }           // successful response                              
  });                                         

But its looks like asynchronous i want the above in synchronous mode also a timeout is occurred but the file is being uploaded to the AWS s3.

So how can i increase the timeout value?? tried with connect-timeout package

app.use(timeout('600000'));

But it dosen't worked



via Blessan Kurien

No comments:

Post a Comment