Sample code for 30+ languages & platforms
React Native

Example: Http.S3_FileExists method

Demonstrates the S3_FileExists method.

Chilkat React Native Downloads

React Native
import { Http } from '@chilkat/react-native'

async function chilkatExample() {
  const http = new Http();

  // Insert your AWS keys here:
  http.awsAccessKey = 'AWS_ACCESS_KEY';
  http.awsSecretKey = 'AWS_SECRET_KEY';

  const bucketName = 'chilkat.ocean';
  const objectName = 'seahorse.jpg';
  http.awsRegion = 'us-west-2';
  http.awsEndpoint = 's3-us-west-2.amazonaws.com';

  const retval = await http.s3FileExistsAsync(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.');
}