Dart
Dart
Wasabi Download String
See more Wasabi Examples
Demonstrates how to download a text Wasabi object to a string variable.Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
final http = CkHttp();
// 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';
final bucketName = 'chilkattest';
final 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.
final charset = 'utf-8';
try {
final fileContents = http.s3DownloadString(bucketName, objectName, charset);
print(fileContents);
print('Success.');
} on ChilkatException catch (e) {
print(e.lastErrorText);
}
}