Я загружаю изображения в s3 с помощью библиотекиact-native-aws3. компонент RNS3. Я успешно загрузил, и я могу получить доступ к URL и просмотреть изображение, однако я не могу найти объект в моем контейнере S3 с помощью консоли AWS. Вот код:
import React from 'react';
import {View, Text, Button, Image} from 'react-native';
import {region, bucket, accessKey, secretKey} from '../auth';
import image from '../assets/background.png';
import { RNS3 } from 'react-native-aws3';
const upload = () => {
const file = {
uri : 'file:///Users/ayunas/Documents/lambda/cooking-recipe-source-control-fe/CookingRecipesExpo/assets/background.png',
name : 'my_logo.png',
type: 'image/png'
}
console.log(file.uri);
const options = {
keyPrefix : "public/",
bucket,
region,
accessKey,
secretKey,
successActionStatus: 201
}
RNS3.put(file, options)
.progress(event => {
console.log(`percent: ${event.percent}`);
})
.then(res => {
if (res.status === 201) {
console.log('response from successful upload to s3:', res.body);
} else {
console.log('status code: ', res.status);
}
})
.catch(err => {
console.log('error uploading to s3', err)
})
}
const get = () => {
Storage.get('amir.txt')
.then(res => console.log('result get', res))
.catch(err => console.log('err getting', err))
}
function ImageUpload(props) {
return (
<View style={{alignItems : 'center'}}>
<Image style={{width: 100, height: 100}} source={image} />
<Text>Click button to upload above image to S3</Text>
<Button title="Upload to S3" onPress={upload}/>
<Button title="Get from S3" onPress={get}/>
</View>
)
}
export default ImageUpload;
Есть ли у вас какие-либо сведения о том, как найти изображение в консоли AWS? Я могу нажать на res.location и перейти к объекту, используя URL. но это все.