@b-fuze/aws-s3
v1.0.4
Published
Minimal no-dep AWS S3 API
Downloads
14
Readme
AWS S3 Client
A minimal zero-dependency S3 client for NodeJS (v12+)
Install
npm i -S @b-fuze/aws-s3
Usage
import { Bucket } from "@b-fuze/aws-s3"
const bucket = new Bucket("my-bucket", {
AWS_ACCESS_KEY_ID: "access-key-id",
AWS_SECRET_ACCESS_KEY: "secret-access-key",
AWS_REGION: "region",
})
bucket.putBuffer("/object/key.ext", someBuffer)
.then(() => {
console.log("Success")
})
API
class Bucket
Base Bucket class
bucket.get(object: string)
object
: Object key
Get an object from the bucket
Returns a promise that resolves to a buffer of the object
bucket.putBuffer(object: string, buffer: Buffer)
object
: Object keybuffer
: Buffer with data
Returns a promise that resolves on success
bucket.putStream(object: string, stream: ReadableStream, size: number)
object
: Object keystream
: Stream with datasize
: Total size of stream
Returns a promise that resolves on success
bucket.delete(object: string)
object
: Object key
Returns a promise that resolves on success
Development
Run the following to build aws-s3
npm run build