fastify-s3-buckets
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

fastify-s3-buckets

Fastify plugin for ensuring existence of defined AWS S3 buckets on the application startup.

NPM Version Build Status

How to use?

import fastify from 'fastify';
import { fastifyS3BucketsPlugin } from 'fastify-s3-buckets';
import { S3Client } from '@aws-sdk/client-s3'

const s3Config = {
    endpoint: 'http://s3.localhost.localstack.cloud:4566',
    region: 'eu-west-1',
    credentials: {
        accessKeyId: 'access',
        secretAccessKey: 'secret',
    },
}
const s3Client = new S3Client(s3Config)

const app = fastify()
app.register(fastifyS3BucketsPlugin, {
    s3Client,
    buckets: [{ Bucket: 'abc' }, { Bucket: 'def' }, { Bucket: 'ghi' }],
})
await app.ready() // missing buckets will be created here

Note that if buckets already exist, they will not be recreated. Existing buckets that are not specified will not be deleted.

Package Sidebar

Install

npm i fastify-s3-buckets

Weekly Downloads

82

Version

1.0.0

License

none

Unpacked Size

5.74 kB

Total Files

5

Last publish

Collaborators

  • kibertoad