(AutoIt) Demonstrate S3_DownloadBytes
Demonstrates how to download a file into memory from the Amazon S3 service.
; This example assumes the Chilkat HTTP API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat_9_5_0.Http")
$oHttp.AwsAccessKey = "AWS_ACCESS_KEY"
$oHttp.AwsSecretKey = "AWS_SECRET_KEY"
Local $sBucketName = "chilkat.qa"
Local $sObjectName = "images/sea_creatures/starfish.jpg"
Local $sLocalFilePath = "qa_output/starfish.jpg"
Local $oJpgBytes
$oJpgBytes = $oHttp.S3_DownloadBytes($sBucketName,$sObjectName)
If ($oHttp.LastMethodSuccess <> True) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Download successful." & @CRLF)
$oFac = ObjCreate("Chilkat_9_5_0.FileAccess")
Local $bSuccess = $oFac.WriteEntireFile($sLocalFilePath,$oJpgBytes)
ConsoleWrite("File saved success = " & $bSuccess & @CRLF)
|