s3asy
Simple S3 integration with a cache backed by Redis
Last updated 8 years ago by andrewjstone .
Repository · Original npm · Tarball · package.json
$ cnpm install s3asy 
SYNC missed versions from official npm registry.

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 

Current Tags

  • 0.4.7                                ...           latest (8 years ago)

12 Versions

  • 0.4.7                                ...           8 years ago
  • 0.4.6                                ...           8 years ago
  • 0.4.5                                ...           8 years ago
  • 0.4.4                                ...           8 years ago
  • 0.4.3                                ...           8 years ago
  • 0.4.2                                ...           8 years ago
  • 0.4.1                                ...           8 years ago
  • 0.4.0                                ...           8 years ago
  • 0.3.0                                ...           8 years ago
  • 0.2.0                                ...           8 years ago
  • 0.1.2                                ...           8 years ago
  • 0.1.1                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |