Sample code for 30+ languages & platforms
Dart

Example: Http.S3_FileExists method

Demonstrates the S3_FileExists method.

Chilkat Dart Downloads

Dart
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.');
}