title: How to download image and store it in database with Firebase functions?
body: <p>I want to create a HTTP trigger Firebase Function which basically gets the image url from request, downloads the image, stores the image in storage and then returns the new image url from storage. The code looks like this so far:</p>
  
  <pre><code>const functions = require('firebase-functions');
  
      exports.mirror = functions.https.onRequest((req, res) =&gt; {
          var url = req.query.url
  
          //TODO: Download image from `url`.
          //TODO: Store downloaded image in Firebase Storage.
          //TODO: Return new image path in Firebase Store.
  
          res.status(200).send(url)
      });
  </code></pre>
  
  <p>How should I go on about solving this? </p>