/volante-s3

volante module for S3

Primary LanguageJavaScript

VolanteS3

Volante module for working with S3 Buckets and Objects

Usage

Due to the way S3 works, VolanteS3 is ready to go immediately after configuration - there is no connection to a server which needs to "succeed" before you can begin making requests.

Easiest way to configure is to include a block for VolanteS3 in your config.json:

{
...
  "VolanteS3": {
    "endpoint": "http://mys3server",
    "accessKey": "W4UXK7TERH1QNBFVQ00I",
    "secretKey": "ydwP5Hcj0650GZNFjjb192rmdu5bh7IjARA0rCbc"
  }
...
}

See src/index.js for the full props and descriptions

VolanteS3 can then be used by calling its methods directly. All methods return a Promise and can be used with await.

Buckets

  • listBuckets() - returns the available buckets
  • createBucket(bucket) - create a bucket with the given name
    • bucket - string - the bucket name
  • deleteBucket(bucket)
    • bucket - string - the bucket name

Objects

  • putObject(bucket, key, body) - insert an object into an S3 bucket
    • bucket - string - the bucket name
    • key - string - the object key name
    • body - string/Buffer/ReadableStream - the object data
  • listObjects(bucket, prefix, maxKeys) - returns metadata for objects in an S3 bucket
    • bucket - string - the bucket name
    • prefix - string - object key prefix to filter listing
    • maxKeys - number - default: 1000 - number of object metadata items to return
  • getObject(bucket, key, asStream) - returns string content of an object
    • bucket - string - the bucket name
    • key - string - the object key name
    • asStream - boolean - default: false - returns a ReadableStream instead of a string
  • deleteObject(bucket, key) - delete an object by key name
    • bucket - string - the bucket name
    • key - string - the object key name