Images are already in server, may be uploaded by multer. now have to make dataUri for s3.
var fs = require('fs'); var uploadPath = 'upload/'; var image = 'blahblah.jpg'; fs.readFile(uploadPath+image, 'base64', function(err, data){ if (err) throw err; var type = image.split('.')[1]; //here is the dataUri var dataUri = 'data:image/'+type+';base64,'+data; console.log(dataUri); });