我正在try 将图像转换为BLOB,以便将其上传到AWS S3存储.我需要在使用EXPO-IMAGE-PICTER Select 图像后将图像转换为BLOB,但它会导致以下错误.
ERROR RangeError: Failed to construct 'Response': The status provided (0) is outside the range [200, 599]., js engine: hermes个
这就是我目前的情况:
import { Button, StyleSheet, Text, View } from 'react-native';
import * as ImagePicker from 'expo-image-picker'
export default function App() {
const PickImage = async()=>{
let result = await ImagePicker.launchImageLibraryAsync({
quality:1,
mediaTypes:ImagePicker.MediaTypeOptions.Images,
})
if(!result.canceled){
let response = await fetch(result.assets[0].uri);
let blob = await response.blob();
//code to upload image
}
}
return (
<View style={styles.container}>
<Button onPress={PickImage} title='TEST'/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
FETCH STSTIME导致错误.
let response = await fetch(result.assets[0].uri);
个
我试着在expo 的零食中建造它,它运行得很好.我没有收到任何错误.但它在我的本地设置上崩溃了.