React Native Requires Chilkat v11.0.0+
React Native
S3 Delete Multiple Objects
See more Amazon S3 Examples
Demonstrates how to delete multiple objects in a single HTTP request.Chilkat React Native Downloads
import { Http, JsonObject, StringTable } from '@chilkat/react-native'
async function chilkatExample() {
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const http = new Http();
// Insert your access key here:
http.awsAccessKey = 'ABQXXABC83ABCDEFVQXX';
// Insert your secret key here:
http.awsSecretKey = 'XXXXYYYYabcdABCD12345678xxxxyyyyzzzz';
const bucketName = 'chilkattestbucket';
const objectName1 = 'starfish.jpg';
// Delete a particular version of this object:
const objectName2 = 'conch.jpg; VersionId="3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo"';
const objectName3 = 'seaUrchin.jpg';
const st = new StringTable();
st.append(objectName1);
st.append(objectName2);
st.append(objectName3);
const jsonResp = new JsonObject();
try {
await http.s3DeleteObjectsAsync(bucketName, st, jsonResp);
} catch {
console.log(http.lastErrorText);
return;
}
// Display the JSON response.
jsonResp.emitCompact = false;
console.log(jsonResp.emit());
}