aws-sdk-js-v3
aws-sdk-js-v3 copied to clipboard
Error: Can't find variable: ReadableStream,use lib-storage upload file to s3 in react-native.
Hi @jereztech, I was getting a different error from #2183 use your code. My environment: "react-native": "0.69.5", "@aws-sdk/client-cognito-identity": "^3.168.0", "@aws-sdk/client-s3": "^3.168.0", "@aws-sdk/credential-provider-cognito-identity": "^3.168.0", "@aws-sdk/lib-storage": "^3.168.0"
Code:
const response = await fetch(uri);
const blob = await response.blob();
const upload = new Upload({
client: s3Client,
params: {
Bucket: bucket,
Key: key,
Body: blob,
},
});
upload.on("httpUploadProgress", (progress) => {
console.log("progress:" + progress);
});
And I still got the error:
Error: Can't find variable: ReadableStream
But when i not to use lib-storage, like:
s3Client.send(new PutObjectCommand({
Bucket: bucket,
Key: key,
Body: blob,
})
it's works fine, but i can't get upload progress information with this method.