在Firebase Cloud Functions中,如何获取刚上传到存储桶的内容的URL?

时间:2018-07-19 16:05:17

标签: firebase google-cloud-functions firebase-storage

The Firebase documentation demonstrates here如何将文件上传到存储桶。

但是,它没有提到如何获取内容的URL,例如,您可以将其发送回用户,以便他们可以访问内容。

.then(() => {
  console.log('Thumbnail created at', tempFilePath);

  // We add a 'thumb_' prefix to thumbnails file name. That's where we'll upload the thumbnail.
  const thumbFileName = `thumb_${fileName}`;
  const thumbFilePath = path.join(path.dirname(filePath), thumbFileName);

  // Uploading the thumbnail.
  return bucket.upload(tempFilePath, {
    destination: thumbFilePath,
    metadata: metadata,
  });

}).then(() => /* How do I return the content URL to the user?? */ );

0 个答案:

没有答案
相关问题