(Swift) Wasabi Download File
Demonstrates how to download a file from a Wasabi bucket.
func chilkatTest() {
// This requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = CkoHttp()!
// 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"
var bucketName: String? = "chilkat-west"
var objectName: String? = "seahorse.jpg"
var localFilePath: String? = "c:/temp/qa_output/seahorse.jpg"
var success: Bool = http.s3_DownloadFile(bucketName, objectName: objectName, localFilePath: localFilePath)
if success != true {
print("\(http.lastErrorText!)")
}
else {
print("File downloaded.")
}
}
|