node-s3rw
A node-task compliant read-write interface for Amazon S3.
API
read(path, options)
Read a file from Amazon S3 and return a promise which resolves to a node-task compliant record.
The options
object supports these keys:
client
A aws2js S3 client (required).bucket
S3 source bucket (required).encoding
The encoding of the file to be read.
var s3rw = var options = client: bucket: '<bucket>';s3rw;
write(record, options)
Save a node-task record to Amazon S3.
The options
object supports these keys:
client
A aws2js S3 client (required).bucket
The destination bucket (required).acl
A valid Canned ACL. Defaults to 'private'. Can also bepublic-read
,public-write
,public-read-write
,authenticated-read
.headers
Set headers for uploaded file (far-future, etc).
var Record = ;var s3rw = ;var options = client: bucket: '<bucket>' acl: 'private' // 'public-read' | 'public-read-write' | 'authenticated-read' headers: "Cache-Control": "max-age=315360000" ; var file = 'test.txt' 'utf8' 'test file';s3rw;
Running Tests
To run the test suite you must first have an S3 account. Then create a file named ./test/s3.json, which contains your credentials and test bucket in this format:
"key": "<api-key-here>" "secret": "<secret-here>" "bucket": "<your-bucket-name>"