(PureBasic) S3 Download File
Demonstrates how to download a file from the Amazon S3 service.
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
CkHttp::setCkAwsAccessKey(http, "AWS_ACCESS_KEY")
CkHttp::setCkAwsSecretKey(http, "AWS_SECRET_KEY")
CkHttp::setCkS3Ssl(http, 1)
CkHttp::setCkAwsRegion(http, "us-west-2")
CkHttp::setCkAwsEndpoint(http, "s3-us-west-2.amazonaws.com")
bucketName.s = "chilkat.qa"
objectName.s = "/images/sea_creatures/starfish.jpg"
localFilePath.s = "qa_output/starfish.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
|