Sample code for 30+ languages & platforms
React Native Requires Chilkat v11.0.0+

Wasabi Delete Bucket Objects

See more Wasabi Examples

Demonstrates how to delete one or more objects in a bucket.

Chilkat React Native Downloads

React Native
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 = 'access-key';

  // Insert your secret key here:
  http.awsSecretKey = 'secret-key';

  // Use the endpoint matching the bucket's region.
  http.awsEndpoint = 's3.us-west-1.wasabisys.com';

  const bucketName = 'chilkattest';

  const objectName1 = 'seahorse.jpg';
  const objectName2 = 'seahorse2.jpg';

  const st = new StringTable();
  st.append(objectName1);
  st.append(objectName2);

  const jsonResp = new JsonObject();
  try {
    await http.s3DeleteObjectsAsync(bucketName, st, jsonResp);
  } catch {
    console.log(http.lastErrorText);
    return;
  }

  console.log(`Response status code = ${http.lastStatus}`);

  // Display the JSON response.
  jsonResp.emitCompact = false;
  console.log(jsonResp.emit());
}