Lua
Lua
S3 Download File
See more Amazon S3 Examples
Demonstrates how to download a file from the Amazon S3 service.Chilkat Lua Downloads
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-west-2"
http.aws_endpoint = "s3-us-west-2.amazonaws.com"
local bucketName = "chilkat.qa"
local objectName = "/images/sea_creatures/starfish.jpg"
local localFilePath = "qa_output/starfish.jpg"
local success = http:s3_download_file(bucketName, objectName, localFilePath)
if not success then
print(http.last_error_text)
else
print("File downloaded.")
end