【发布时间】:2019-03-30 19:10:25
【问题描述】:
我正在使用 Meteor 项目将图像从 iOS 设备上传到谷歌云,并将相同的图像下载到 iOS 设备。
上传图片时我没有遇到任何问题,它存储在谷歌存储桶中。我面临的问题是在下载图像时,我使用下面的代码下载服务器路径上的图像。
bucket.file(srcFilename).download(options);
我想下载图像并将其存储在 iOS 设备上。 当我尝试使用 createReadStream 读取文件时,我的应用卡住了,没有任何进展(没有得到任何回调)。
bucket.file(srcFilename).createReadStream()
.on('error', function(err) {
console.log("error");
})
.on('response', function(response) {
// Server connected and responded with the specified status and
console.log("response");
})
.on('end', function() {
// The file is fully downloaded.
console.log("The file is fully downloaded.");
})
我希望在将图像下载到 iOS 设备时不会丢失任何内容。我看了看,但找不到任何其他选项来做同样的事情。
非常感谢您在这方面的任何帮助,因为我被困在这一点上。
【问题讨论】:
标签: node.js meteor google-cloud-storage