问题
I am use Node.js Firebase Cloud Function but need get image I have store in Firebase Storage so I can send to Google Cloud vision API.
Vision API require send from local image file:
// const fileName = 'Local image file, e.g. /path/to/image.png';
// Performs safe search detection on the local file
const [result] = await client.safeSearchDetection(fileName);
const detections = result.safeSearchAnnotation;
How to download remote image into local storage?
For example I want store this image in local storage:
  const image = await axios.get(imgUrl)
  
    回答1:
Why don't you save to filesystem https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback , remember the name to get later. Something like:
const image = await axios.get(imgUrl);
const path = '/home/some/path/somefilename.jpg'
fs.writeFile(path, image, function(err, data) {
    if (err) {
        throw (err);
    }
    // save filepath to wherever for later.
    
});
    来源:https://stackoverflow.com/questions/64969703/how-to-download-image-into-local-storage