Sample code for 30+ languages & platforms
PowerShell

Demonstrate S3_DownloadBytes

Demonstrates how to download a file into memory from the Amazon S3 service.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

# This example assumes the Chilkat HTTP API to have been previously unlocked.
# See Global Unlock Sample for sample code.

$http = New-Object Chilkat.Http

$http.AwsAccessKey = "AWS_ACCESS_KEY"
$http.AwsSecretKey = "AWS_SECRET_KEY"

$bucketName = "chilkat.qa"
$objectName = "images/sea_creatures/starfish.jpg"
$localFilePath = "qa_output/starfish.jpg"

$jpgBytes = $http.S3_DownloadBytes($bucketName,$objectName)
if ($http.LastMethodSuccess -ne $true) {
    $($http.LastErrorText)
    exit
}

$("Download successful.")

$fac = New-Object Chilkat.FileAccess
$success = $fac.WriteEntireFile($localFilePath,$jpgBytes)
$("File saved success = " + $success)