(Swift) Wasabi FTP Download
Demonstrates how to download a file from a Wasabi bucket using FTP.
Note: This example requires Chilkat v9.5.0.89 or greater.
func chilkatTest() {
var success: Bool = false
// This example assumes the Chilkat HTTP API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let ftp = CkoFtp2()!
// Use the domain for the bucket you'll be managing.
ftp.hostname = "s3.s3.us-west-1.wasabisys.com"
// Use your root account username (email address) and root account password
ftp.username = "root_account_username"
ftp.password = "root_account_password"
ftp.ssl = true
ftp.port = 990
success = ftp.connect()
if success == false {
print("\(ftp.lastErrorText!)")
return
}
// Upload a file (starfish.jpg) to the bucket named "chilkat"
var localFilePath: String? = "qa_output/starfish.jpg"
var remoteBucketPath: String? = "/chilkat/starfish.jpg"
success = ftp.getFile(remoteBucketPath, localPath: localFilePath)
if success == false {
print("\(ftp.lastErrorText!)")
return
}
print("File uploaded.")
}
|