最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

如何以BLOB格式将图像上传到Firebase存储?

运维笔记admin4浏览0评论

如何以BLOB格式将图像上传到Firebase存储?

如何以BLOB格式将图像上传到Firebase存储?

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

我在服务器端使用admin-sdk(Node JS),有一个“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);
});
回答如下:

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

发布评论

评论列表(0)

  1. 暂无评论