amazon web services - Is it possible to use aws sdk for upload data to s3 from file path -


i using aws sdk upload file s3 like:

let params = {    body: fileinbase64format... };  s3.upload(params); 

what trying avoid loading file in memory want make this:

let params = {    body: 'file:///...path-to-file.mov' }; s3.upload(params); 

i using react native v0.44
possible upload file avoid base64?

yes can add file path filestream , run s3.putobject method upload s3.

var fstream = fs.createreadstream("file:///...path-to-file.mov"); var parameters = {     bucket: s3bucket,     key: newkey,     body: fstream  }; s3.putobject(parameters, function(error, data){     if(error){         console.error(error);     } else {         console.log(data);     } }); 

hope help!


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -