SimpleS3 is a very simple S3 http client. It wraps hyperquest for HTTP requests, and faketoe for xml parsing.
Usage
Installation
npm install simples3
Setup
Simply pass a config in with a key, secret, and optional host (host defaults to Amazon's S3 service)
var config = key: 'AWSKEY' secret: 'AWSSECRET' host: 'https://s3.amazonaws.com' simpleS3 = s3Store = simpleS3;
List buckets
s3Store;
Bucket info
s3Store;
Create bucket
s3Store;
Delete bucket
s3Store;
Get object
// Note that this returns a response object from S3 as well as the objects3Store; // This function also returns a stream that can be piped directly to a writable streams3Store;
Get signed url to object
var expires = ;expires; // JavaScript date object: one hour from nows3store;
Create object
// You can either send data directlyvar fileinfo = data: fs type: 'image/png'; s3Store; // Or you can provide some metadata and stream the datavar fileinfo = type: 'image/png' size: 65432 // you're on your own to determine this before starting the stream; fs;
Update object
Works just like creating an object, just use updateObject instead. There isn't much of a distinction between the two in S3
Delete object
s3Store;
Parse a url
s3Store; // Also works synchronouslyvar parts = s3Store;