node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »

cas3

cas3

NPM version Build status Test coverage Dependency Status License Downloads Gittip

S3-backed content addressable storage. Store files by their sha256 sum. Automatically compresses it in S3 if it's compressible.

var cas = new CAS(options)

var CAS = require('cas3')
var cas = new CAS(options)

Options are:

  • bucket - s3 bucket name
  • key - s3 key
  • secret - s3 secret key
  • cdn - optional CDN host, defaulting to the s3 bucket, such as https://lakjsflkajfd.cloudfront.net

cas.key(buffer | string, extension).then( key => )

Get an S3 key from a string or a buffer and an extension.

var key = await cas.key('some string', 'txt')

var url = cas.url(key, cdn?)

Get a URL for the key, depending on whether you'd like to use the S3 bucket directly or a CDN.