react-native - React-Native blob 不存在
问题描述
我需要向 AWS S3 发送一个 blob。
我正在使用 react-native-fetch-blob 并尝试使用以下内容来获得一个想法:但我总是得到错误 build does not exist on type
https://github.com/wkh237/rn-firebase-storage-upload-sample/blob/master/index.common.js
import RNFetchBlob from 'react-native-fetch-blob';
const Blob = RNFetchBlob.polyfill.Blob;
window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest;
window.Blob = Blob;
Blob
.build(rnfbURI, { type : 'image/png;'})
.then((blob) => {
// upload image using Firebase SDK
firebase.storage()
.ref('images')
.child(fileName)
.put(blob, { contentType : 'image/jpg' })
.then((snapshot) => {
console.log('Uploaded', snapshot.totalBytes, 'bytes.');
console.log(snapshot.metadata);
var url = snapshot.metadata.downloadURLs[0];
console.log('File available at', url);
}).catch(function(error) {
console.error('Upload failed:', error);
})
}
解决方案
推荐阅读
- bluetooth-lowenergy - BLE Beacon 连接到外围设备
- java - 当我将任务放入 gradle 文件时,不会发生 Liquibase db 迁移
- java - 在日语排序中将拉丁字符排序到末尾
- omnet++ - 车辆的当前位置?
- java - Maven 在 Maven 安装目标期间找不到 assertEquals 符号
- r - 在R中使用apply或map函数时如何将列名传递给函数?
- amazon-dynamodb - DynamoDB 版本是否不可知
- php - 继续登录会话 Fuel
- sql - 如何将列中的单个文本转换为sql中的行?
- azure-cloud-services - Azure Database for MYSQL 频繁连接失败