Lua
Lua
Wasabi Download String
See more Wasabi Examples
Demonstrates how to download a text Wasabi object to a string variable.Chilkat Lua Downloads
local chilkat = require("chilkat")
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local http = chilkat.Http.new()
-- Insert your access key here:
http.aws_access_key = "access-key"
-- Insert your secret key here:
http.aws_secret_key = "secret-key"
-- Use the endpoint matching the bucket's region.
http.aws_endpoint = "s3.us-west-1.wasabisys.com"
local bucketName = "chilkattest"
local objectName = "orchard.json"
-- This is the byte representation of the text file downloaded from Wasabi.
-- It must be specified to allow Chilkat to correctly interpret the bytes as characters.
local charset = "utf-8"
local fileContents = http:s3_download_string(bucketName, objectName, charset)
if not http.last_method_success then
print(http.last_error_text)
else
print(fileContents)
print("Success.")
end