【问题标题】:How to upload an image in BLOB format to Firebase Storage?如何将 BLOB 格式的图像上传到 Firebase 存储?
【发布时间】:2019-07-11 03:49:38
【问题描述】:

我在 SQLite 数据库中有一个 BLOB 类型的图像,我想将该图像上传到 Firebase 存储,获取图像的下载 URL 和尺寸,并将它们添加到 Firebase 实时数据库。我已经使用 bucket.upload 从本地驱动器成功上传了一张图片,但我不知道如何上传 Blob。

我在服务器端(NodeJS)使用 admin-sdk,有一个“put”功能,但它在客户端 sdk 中。

bucket.upload("./file.jpeg", options).then(result => {
  const file = result[0];
  console.log(file)
}).then(results => {
  console.log(results);
}).catch(error => {
  console.error(error);
});

【问题讨论】:

标签: node.js firebase-realtime-database google-cloud-storage firebase-admin


【解决方案1】:

如果要直接发送 blob,则必须使用流式传输。有提供此功能的第三方库:https://cloud.google.com/storage/docs/boto-plugin#streaming-transfers

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-01-25
    • 2017-03-27
    • 2018-12-17
    • 1970-01-01
    • 1970-01-01
    • 2022-11-03
    • 2017-09-25
    相关资源
    最近更新 更多