Firebase 存储:file().move 没有实现?
Firebase storage: file().move is not implemented?
我正在使用 firebase 模拟器在本地进行开发。
前端应用创建一个项目,其中一些文件上传到存储桶中的 'tmp/' 文件夹。
保存项目后,我需要将上传的文件移动到项目文件夹中。但是当做(云功能)
const storage = new Storage();
// also tried:
// const storage = admin.storage();
const bucket = storage.bucket(DEFAULT_BUCKET);
const destRoot = `${project.id}/files`;
// `tmpFiles` is an array of file paths
const movedfiles = await Promise.all(
tmpFiles.map((file: string) =>
bucket
.file(`tmp/${file}`)
.move(`${destRoot}/${file}`)
.then((result) => result[0].publicUrl())
.catch(console.log)
)
);
我遇到了这个错误
ApiError: file#copy failed with an error - Not Implemented
所以暂时无法移动存储文件?
Firebase 模拟器通常 only/first 实现客户端 SDK 中也可能实现的操作。由于用于云存储的客户端 SDK 没有 API 来移动文件,因此当使用 Admin SDK 时,该操作(当前)也未在模拟器中实现。
此特定功能在 Github 存储库中被跟踪为 #3751,因此我建议检查那里的更新,或提交添加该功能的 PR。
我正在使用 firebase 模拟器在本地进行开发。
前端应用创建一个项目,其中一些文件上传到存储桶中的 'tmp/' 文件夹。
保存项目后,我需要将上传的文件移动到项目文件夹中。但是当做(云功能)
const storage = new Storage();
// also tried:
// const storage = admin.storage();
const bucket = storage.bucket(DEFAULT_BUCKET);
const destRoot = `${project.id}/files`;
// `tmpFiles` is an array of file paths
const movedfiles = await Promise.all(
tmpFiles.map((file: string) =>
bucket
.file(`tmp/${file}`)
.move(`${destRoot}/${file}`)
.then((result) => result[0].publicUrl())
.catch(console.log)
)
);
我遇到了这个错误
ApiError: file#copy failed with an error - Not Implemented
所以暂时无法移动存储文件?
Firebase 模拟器通常 only/first 实现客户端 SDK 中也可能实现的操作。由于用于云存储的客户端 SDK 没有 API 来移动文件,因此当使用 Admin SDK 时,该操作(当前)也未在模拟器中实现。
此特定功能在 Github 存储库中被跟踪为 #3751,因此我建议检查那里的更新,或提交添加该功能的 PR。