@dstanesc/s3-block-store
v0.0.3
Published
Simple content-addressable storage (CAS) based on AWS S3
Downloads
92
Readme
S3 Block Store
Simple content-addressable storage (CAS) based on AWS S3.
API
put: (block: { cid: any, bytes: Uint8Array }) => Promise<void>
get: (cid: any) => Promise<Uint8Array>
Usage
import AWS from 'aws-sdk'
import { blockStore } from '@dstanesc/s3-block-store'
AWS.config.update({region: 'us-east-1'})
const s3 = new AWS.S3()
const cache = {}
// bucket configured in https://s3.console.aws.amazon.com/s3/buckets
const bucket = ...
// s3-block-store api
const { get, put } = blockStore({ /*cache,*/ s3, bucket });
Build
npm run clean
npm install
npm run build
Test
AWS storage configuration and security credentials
export AWS_BUCKET_NAME=...
export AWS_REGION=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_ACCESS_KEY_ID=...
npm run test
Licenses
Licensed under either Apache 2.0 or MIT at your option.