2

I have an image in the SQLite database as a BLOB type, I want to upload that image into firebase storage, get download URL and dimensions of the image, and add them to Firebase real-time database. I've successfully uploaded an image from the local drive with bucket.upload but I have no idea how can I upload a blob.

I am using admin-sdk on the serverside (NodeJS), there is a "put" function but that's in client-side sdk.

bucket.upload("./file.jpeg", options).then(result => {
  const file = result[0];
  console.log(file)
}).then(results => {
  console.log(results);
}).catch(error => {
  console.error(error);
});
aaqilniz
  • 66
  • 2
  • 5
  • To upload files to Cloud Storage from Node.js, see https://cloud.google.com/nodejs/docs/reference/storage/1.7.x/Bucket#upload Some previous questions on the topic: https://stackoverflow.com/questions/39848132/upload-files-to-firebase-storage-using-node-js, https://stackoverflow.com/questions/49719366/uploading-to-google-cloud-storage-with-node-js, https://stackoverflow.com/questions/51207162/how-can-i-upload-files-to-firebases-cloud-storage-with-a-path-using-the-admin-s – Frank van Puffelen Feb 17 '19 at 17:53

1 Answers1

0

You have to use streaming transfert if you want to send a blob directly. There is a third party library providing this functionality: https://cloud.google.com/storage/docs/boto-plugin#streaming-transfers

Aschen
  • 1,691
  • 11
  • 15