使用 NodeJs 从 Firebase 存储下载文件

问题描述

我正在编写 API 以使用 Nodejs 从 Firebase 下载文件。这是我的代码

router.get('/download/file/:name',(req,res) => {
    let destFilename = './Downloads';
    var name = req.params.name;
    const options = {
        // The path to which the file should be downloaded
        destination: destFilename,};
    bucket.file('myimage/' + name).download(options).then((value) => {
        console.log('Downloaded.');
        return res.status(200).json();
    }).catch((error) => {
        console.log(error);
        return res.status(500).json();
    });
});

我测试了这个 API 成功下载了几次,但即使它记录了“已下载”,也没有下载更多文件

我哪里做错了?请帮我。 非常感谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)