0

I'm running a node server at a specified url for a webhook. The Webhook is a simple ”image-has-been-processed”-notification via HTTP POST containing the URL to download the image (processedImageURL). I want to take that image and store it in Firebase storage.

My question is, how do I download this image and convert it to a blob or something that can be successfully uploaded to Firebase?

Here is my code. I'm using the Hapi framework btw. Thanks!

server.route({
    method: 'POST',
    path: 'https://snapshelf-aa1b5.firebaseapp.com/pixelz',
    handler: function (request, reply) {

      // Get payload

      const payload = request.payload;

      reply('success');

      // How do I convert processedImageURL into blob? Below code won't work obviously

      const imageURL = payload.processedImageURL;

      // Store image in Firebase

      storageRef.put(imageURL).then(snapshot => {
        snapshot.ref.getDownloadURL()
      })

      // db.ref('/testImages/').push(downloadURL);
    }
});
simon-p-r
  • 3,623
  • 2
  • 20
  • 35
maxwellgover
  • 6,661
  • 9
  • 37
  • 63

0 Answers0