Sample code for 30+ languages & platforms
JavaScript

Backblaze S3 Delete Bucket Objects

See more Backblaze S3 Examples

Demonstrates how to delete objects in a bucket.
Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat v11.4.0 or greater.
JavaScript
var success = false;

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

var http = new CkHttp();

// keyID = Access Key ID or Access Key
http.AwsAccessKey = "access-key";

// applicationKey = Secret Access Key or Secret Key
http.AwsSecretKey = "secret-key";

// Region is the 2nd part of your S3 Endpoint
http.AwsEndpoint = "s3.us-west-002.backblazeb2.com";

var bucketName = "chilkat-test";

var objectName1 = "seahorse.jpg";
var objectName2 = "orchard.json";

var st = new CkStringTable();
st.Append(objectName1);
st.Append(objectName2);

var resp = new CkHttpResponse();
success = http.S3_DeleteObjects(bucketName,st,resp);
if (success == false) {
    console.log(http.LastErrorText);
    return;
}

console.log("Response status code = " + http.LastStatus);

// Display the XML response.
console.log(resp.BodyStr);