0.4.7 • Published 12 years ago

s3asy v0.4.7

Weekly downloads
53
License
-
Repository
github
Last release
12 years ago

Introduction

s3asy ('S-Three-Zee') is a simple library for issuing GET, PUT, and DELETE requests against Amazon S3. It allows caching of files in a local redis instance using the If-Modified-Since and `Date headers as cache-control.

It achieves this simplicity by utilizing knox and cacheit under the hood.

Warning: Don't use this for large objects, as it obviously buffers them in memory. Also Redis cannot cash strings larger than 512 MB.

Example

var S3 = require('s3asy');
var s3 = new S3({
  key: '<api-key-here>',
  secret: '<secret-here>',
  bucket: 'bucket-name',
  cache: true
});

s3.get('/some/path', {'x-amz-acl': 'private'}, function(err, body) {
  console.log(body);
});

API

s3.get(path, headers, callback)

s3.put(path, headers, data, callback)

Requires Content-Type and Content-Length headers

s3.delete(path, headers, callback)

s3.copy(dst_path, src_path, src_bucket, headers, callback)

  • dst_path - the destination filename
  • src_path - the source filename
  • src_bucket - the source bucket. The dst_bucket is the bucket passed to the constructor.

Requires Content-Type and Content-Length headers

s3.ls(path, callback)

List files with a given prefix (path). Do NOT use a leading slash.

Run Tests

Ensure you have mocha installed.

npm install mocha

Add a config file for s3asy to use in ~/.s3asy_test_config.js.

module.exports = {
  key: '<api-key-here>',
  secret: '<secret-here>',
  bucket: 'bucket-name',
  cache: true
};

Run tests

cd test
mocha test.js --reporter spec 
0.4.8

6 years ago

0.4.7

12 years ago

0.4.6

12 years ago

0.4.5

12 years ago

0.4.4

12 years ago

0.4.3

12 years ago

0.4.2

12 years ago

0.4.1

12 years ago

0.4.0

12 years ago

0.3.0

12 years ago

0.2.0

12 years ago

0.1.2

12 years ago

0.1.1

12 years ago