簡體   English   中英

如何使用 Node.js 上的 blob 將圖像存儲在 firebase 存儲上

[英]How to store image on firebase storage with blob on Node.js

From the frontend this could easily be done with the uploadBytes function, but the firebase admin storage package only has an upload method that requires a local URL to an image. 如何發送 blob?

您可以將緩沖區寫入臨時文件,上傳它,然后刪除該文件。 你可以做這樣的事情

fs.writeFileSync('somepath.something', Buffer.from(pass - your - data - here))
// Upload your data
await firebase().storage().bucket().upload('somepath.something')
// Delete the temporary file
fs.unlinkSync('somepath.something')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM