Sample code for 30+ languages & platforms
React Native

Example: Http.S3_DownloadBd method

See more Amazon S3 Examples

Demonstrates the S3_DownloadBd method.

Chilkat React Native Downloads

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

async function chilkatExample() {
  // This requires the Chilkat API to have been previously unlocked.
  // See Global Unlock Sample for sample code.

  const http = new Http();

  http.awsAccessKey = 'AWS_ACCESS_KEY';
  http.awsSecretKey = 'AWS_SECRET_KEY';
  http.awsRegion = 'us-west-2';
  http.awsEndpoint = 's3-us-west-2.amazonaws.com';

  const bucketName = 'chilkat.qa';
  const objectName = '/images/sea_creatures/starfish.jpg';
  const localFilePath = 'qa_output/starfish.jpg';

  const bd = new BinData();
  try {
    await http.s3DownloadBdAsync(bucketName, objectName, bd);
  } catch {
    console.log(http.lastErrorText);
    return;
  }

  console.log(`Downloaded ${bd.numBytes} bytes`);
}