Right now, I've passed the canvas data URI string
(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAADwCAYAAABxLb1rAAAgAElEQVR..... )
to my hapi (NodeJS) server.
My question is:
What are my next steps to "stream"/upload this data to Amazon S3 and create an actual image there?
before send object to s3 you must transform base64 to buffer and after send, for example:
var buf = new Buffer(b64string, 'base64');
s3.putObject({/*some params*/, Body: buf}, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
After this you send data to s3 and you will can open image without decode.
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With