Erlang bindings for s3.
start things up by erls:start_link(Bucket). Bucket = string(), the default bucket you want to start out using.
For setup change the following:
-define(ACCESS_KEY, "MY_ACCESS_KEY").
-define(SECRET_KEY, "MY_SECRET_KEY").
-define(AWS_S3_HOST, "s3.amazonaws.com").
-define(TIMEOUT, infinity).
-define(CHUNK_SIZE, 1024 5).
put_file and get_file both stream the file from and to the hard drive respectively they both return immediately with ok but send back a message on the progress of the file transfer.
for put_file the CHUNK_SIZE definition can be set which controls how much of the file is read from the hard and set in memory to be sent before reading more, after each send a message is sent to the process that asked to put file
{data_sent, Size, Delta}
Size = integer() - size of the data sent, this is usually CHUNK_SIZE
Delta = integer() - the amount of time it took to send Size this can used to calculate the current transfer speed when complete a send_complete message is sent
for get_file
{writing, Size}
Size = integer() - amount of data received and written to the hd
when completed
{file_writen, Current_size}
Current_size = integer() - total file size written
puts a file to s3
put_file(local_filename) -> ok
local_filename = string()
puts a file to s3
put_file(local_filename, remote_filename) -> ok
local_filename = string()
remote_filename = string()
puts a file to s3
put_file(local_filename, remote_filename, Acl) -> ok
local_filename = string()
remote_filename = string()
Acl = string() = "private" | "public-read" | "public-read-write" | "authenticated-read"
lists all the buckets owned
list_buckets() -> list()
creates a new s3 bucket
create_bucket(Bucket) -> {ok, Bucket} | {error, bucket_exists}
Bucket = string()
changes the current working bucket
change_bucket(Bucket) -> {bucket_changed, Bucket}
lists the keys in the current bucket
list_keys() -> list()
get the acl for the resource
get_acl(Resource) -> list()
Resource = string()
set the canned acl for a key
set_acl(Resourse, Acl) -> ok |
Resourse = string()
Acl = string() = "private" | "public-read" | "public-read-write" | "authenticated-read"
error code for any s3 query
{error, Code, Code_string, {Headers, Response}};
Code = string()
Code_string = string()
Headers = list()
Responce = string()