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?? */ );