【发布时间】:2022-01-07 04:31:14
【问题描述】:
这是我的第一个堆栈帖子,如果有点模糊,请见谅:/
所以基本上我有一个 Angular 项目,后面有 firestore。我有一个云函数,它生成一个 .xlsx 文件并将其上传到我的 fireStorage。
const path = 'hellothere/excels';
return workBook.xlsx.writeFile(`/tmp/myExcel.xlsx`).then(() => {
return storageFb.upload( `/tmp/myexcel.xlsx`,{
destination: path+'/myExcel.xlsx',
}
)
}).then(() => path);
StorageFb 是我的存储桶。
实际上它正在工作,它在 /hellothere/excels/ 下上传我的 .xlsx 文件,名称为 myExcel.xlsx。但是当我下载它时(通过管理面板或我的 Angular 客户端),它的全名是 hellothere_excels_myExcel.xlsx。
这是我的客户端代码:
this.fireStorage.ref('hellothere/excels/myExcel.xlsx').getDownloadURL().subscribe((url) => {
window.open(url, '_blank');
});
return Promise.resolve();
很简单。我知道代码很乱,但我正在测试我能找到的所有解决方案,所以我会把它清理干净
所以我有点卡住了,因为我不知道为什么这些文件不会只用“myExcel”名称下载。 如果有人知道你会拯救我的一周啊哈!谢谢!
【问题讨论】:
标签: node.js angular excel google-cloud-storage firebase-storage