(PureBasic) Wasabi Download File
Demonstrates how to download a file from a Wasabi bucket.
IncludeFile "CkHttp.pb"
Procedure ChilkatExample()
; This requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; Insert your access key here:
CkHttp::setCkAwsAccessKey(http, "access-key")
; Insert your secret key here:
CkHttp::setCkAwsSecretKey(http, "secret-key")
; Use the endpoint matching the bucket's region.
CkHttp::setCkAwsEndpoint(http, "s3.us-west-1.wasabisys.com")
bucketName.s = "chilkat-west"
objectName.s = "seahorse.jpg"
localFilePath.s = "c:/temp/qa_output/seahorse.jpg"
success.i = CkHttp::ckS3_DownloadFile(http,bucketName,objectName,localFilePath)
If success <> 1
Debug CkHttp::ckLastErrorText(http)
Else
Debug "File downloaded."
EndIf
CkHttp::ckDispose(http)
ProcedureReturn
EndProcedure
|