Sample code for 30+ languages & platforms
Tcl

S3 Download String Object

See more Amazon S3 Examples

Demonstrates how to download a text file (i.e. object) from the Amazon S3 service directly into an in-memory string variable.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

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

set http [new_CkHttp]

# Insert your access key here:
CkHttp_put_AwsAccessKey $http "AWS_ACCESS_KEY"

# Insert your secret key here:
CkHttp_put_AwsSecretKey $http "AWS_SECRET_KEY"

# This bucket is in the us-east-1 region.
CkHttp_put_AwsRegion $http "us-east-1"

set bucketName "chilkat-test-bucket"

set objectName "fruit.xml"

set charset "utf-8"

set fileContents [CkHttp_s3_DownloadString $http $bucketName $objectName $charset]

if {[CkHttp_get_LastMethodSuccess $http] != 1} then {
    # Failed
    puts [CkHttp_lastErrorText $http]
} else {
    # Success
    puts "$fileContents"
}


delete_CkHttp $http