How to save a image from Node to DigitalOcean spaces?

Posted October 12, 2020 3.1k views
Node.jsDigitalOcean Spaces

Greetings, I have a backend in node.js for my Android App,the backend receive a encode base64 image, then write using “fs.writeFileSync” but i wanna change to save in DigitalOcean Space, there a way to do that?

PD: Sorry for me bad english

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers

Hi @bytesve,

I’ll recommend giving the following Digitalocean tutorial a read :

In this tutorial, you will create a Node.js application that allows a user to upload a file to their DigitalOcean Space by submitting a form on the front-end of a website. It should help you out in regards to your application as well.


by Tania Rascia
Create a Node.js app to upload a file to your DigitalOcean Space

Try this, you should use the resized images content.

$imageresize = $imageresize->resize(50, 50, function ($constraint) {

Storage::disk('spaces’)->put($thumbuploads .’/’.$image->hashName(), (string) $imageresize);

Thanks, for now i am gonna save images in my DO droplet without DO spaces, that’s because are receive the images encoded in base64 and i dont found the way to pass to DO spaces