Sample code for 30+ languages & platforms
React Native

Wasabi Download String

See more Wasabi Examples

Demonstrates how to download a text Wasabi object to a string variable.

Chilkat React Native Downloads

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

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

  const http = new Http();

  // Insert your access key here:
  http.awsAccessKey = 'access-key';

  // Insert your secret key here:
  http.awsSecretKey = 'secret-key';

  // Use the endpoint matching the bucket's region.
  http.awsEndpoint = 's3.us-west-1.wasabisys.com';

  const bucketName = 'chilkattest';
  const objectName = 'orchard.json';

  // This is the byte representation of the text file downloaded from Wasabi.
  // It must be specified to allow Chilkat to correctly interpret the bytes as characters.
  const charset = 'utf-8';

  try {
    const fileContents = await http.s3DownloadStringAsync(bucketName, objectName, charset);
    console.log(fileContents);
    console.log('Success.');
  } catch {
    console.log(http.lastErrorText);
  }
}