JavaScript
JavaScript
Example: Http.S3_FileExists method
Demonstrates theS3_FileExists method.
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.
var http = new CkHttp();
// Insert your AWS keys here:
http.AwsAccessKey = "AWS_ACCESS_KEY";
http.AwsSecretKey = "AWS_SECRET_KEY";
var bucketName = "chilkat.ocean";
var objectName = "seahorse.jpg";
http.AwsRegion = "us-west-2";
http.AwsEndpoint = "s3-us-west-2.amazonaws.com";
var retval = http.S3_FileExists(bucketName,objectName);
if (retval < 0) {
console.log("Failed to check for the S3 object existence");
console.log(http.LastErrorText);
return;
}
if (retval == 0) {
console.log("The S3 object does not exist.");
return;
}
console.log("The S3 object exists.");