Sample code for 30+ languages & platforms
Lua Requires Chilkat v9.5.0.89+

S3 Download Specific Version of File

See more Amazon S3 Examples

Demonstrates how to download a file from the Amazon S3 service using the versionId query parameter.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

-- This requires the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.

local http = chilkat.Http.new()

http.aws_access_key = "AWS_ACCESS_KEY"
http.aws_secret_key = "AWS_SECRET_KEY"
http.aws_region = "us-east-1"
http.aws_endpoint = "s3.amazonaws.com"
http.aws_sub_resources = "versionId=x8UPzRsgskmbe55lEQvhLi25PQl2lcFH"

local bucketName = "chilkat100"
local objectName = "frenchUtf8.txt"
local localFilePath = "qa_output/frenchUtf8.txt"

local success = http:s3_download_file(bucketName, objectName, localFilePath)

if not success then
    print(http.last_error_text)
else
    print("File downloaded.")
end