【发布时间】:2021-08-04 04:28:27
【问题描述】:
几天来,我一直在尝试通过 firebase 函数将文件上传到 firestorage,但仍未成功。 这是我来的最远的:
export const tester = functions.https.onRequest(async (request, response) => {
await STORAGE.bucket("[url]").upload("dir", {
destination: "dest",
});
response.send(STORAGE);
});
但还是不行,因为我要上传blob
而且我之前已经在git中尝试过google的例子,但是我的typescript有问题
function uploadRef() {
// [START storage_upload_ref]
// Create a root reference
var storageRef = firebase.storage().ref();
// Create a reference to 'mountains.jpg'
var mountainsRef = storageRef.child('mountains.jpg');
// Create a reference to 'images/mountains.jpg'
var mountainImagesRef = storageRef.child('images/mountains.jpg');
// While the file names are the same, the references point to different files
mountainsRef.name === mountainImagesRef.name; // true
mountainsRef.fullPath === mountainImagesRef.fullPath; // false
// [END storage_upload_ref]
}
有什么帮助吗?
【问题讨论】:
-
您可以添加您要执行的步骤列表吗?你将什么数据传递给函数?是
multipart/form-data请求吗?
标签: typescript firebase google-cloud-functions