Dart
Dart
Example: Http.S3_FileExists method
Demonstrates theS3_FileExists method.
Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
final http = CkHttp();
// Insert your AWS keys here:
http.awsAccessKey = 'AWS_ACCESS_KEY';
http.awsSecretKey = 'AWS_SECRET_KEY';
final bucketName = 'chilkat.ocean';
final objectName = 'seahorse.jpg';
http.awsRegion = 'us-west-2';
http.awsEndpoint = 's3-us-west-2.amazonaws.com';
final retval = http.s3FileExists(bucketName, objectName);
if (retval < 0) {
print('Failed to check for the S3 object existence');
print(http.lastErrorText);
return;
}
if (retval == 0) {
print('The S3 object does not exist.');
return;
}
print('The S3 object exists.');
}