s3store

convenient storage of objects and files in S3

npm install s3store
2 downloads in the last week
5 downloads in the last month

S3store

Use AWS S3 as a database for files and objects.

Documentation

createClient(accessKey, secret)

var createClient = require('s3db')
var client = createClient('your_access_key', 'your_secret')

client.bucket(name, [region])

var bucket = client.bucket('your_bucket', 'eu-west-1')

bucket.writeFile(fromPath, path, [opts], cb)

With options being:

  • contentType (default: text/plain)
  • public (default: false)

On success cb passes the full S3 url of the object.

bucket.writeFile('your_file.txt', '/s3_path.txt', {public: true}, function(err, url) {
  // passes url as full S3 url of object
})

bucket.readFile(path, cb)

cb passes an IncomingMessage.

bucket.writeObject(path, object, opts, cb)

With options being:

  • public (default: false)

On success cb passes the full S3 url of the object.

bucket.readObject(path, cb)

npm loves you