Xbase++
Xbase++
Example: Http.S3_DownloadBd method
See more Amazon S3 Examples
Demonstrates theS3_DownloadBd method.
Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oHttp
LOCAL cBucketName
LOCAL cObjectName
LOCAL cLocalFilePath
LOCAL oBd
nSuccess := 0
// This requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oHttp := CreateObject("Chilkat.Http")
oHttp:AwsAccessKey := "AWS_ACCESS_KEY"
oHttp:AwsSecretKey := "AWS_SECRET_KEY"
oHttp:AwsRegion := "us-west-2"
oHttp:AwsEndpoint := "s3-us-west-2.amazonaws.com"
cBucketName := "chilkat.qa"
cObjectName := "/images/sea_creatures/starfish.jpg"
cLocalFilePath := "qa_output/starfish.jpg"
oBd := CreateObject("Chilkat.BinData")
nSuccess := oHttp:S3_DownloadBd(cBucketName, cObjectName, oBd)
IF (nSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
oBd:destroy()
RETURN
ENDIF
? "Downloaded " + Str(oBd:NumBytes) + " bytes"
oHttp:destroy()
oBd:destroy()