0.0.4 • Published 8 months ago

@fixers/s3 v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

S3 Drive

npm version npm downloads License

Wrap common s3 functionality!

This library provide a way to work within a single bucket easily by linking together an s3 instance and a bucket name into a single class.

As with any wrapper, you lose some functionality, however you can always access the s3 instance and any custom configuration, the library re-export all the internal methods with the prefix s3_ so you can use them at will.

This package is ESM only!

This package is for Node 18 and above only!

Install

pnpm i @fixers/s3
npm install @fixers/s3

Usage

The easiest way is to use the S3Drive.

import { s3 } from '@fixers/s3'

const drive = s3({
  publicUrl: 'https//domain/',
  bucket: 'bucket-name',

  // common s3 properties
  region: 'auto',
  credentials: {
    accessKeyId: '',
    secretAccessKey: '',
  },
})

await drive.get('file.txt')

Configure using S3Client

If you prefer to configure s3 by yourself:

import { S3Client } from '@aws-sdk/client-s3'
import { S3Drive } from '@fixers/s3'

const s3 = new S3Client({ })
const drive = new S3Drive(s3, {
  bucket: 'bucket-name',
})
0.0.3

10 months ago

0.0.4

8 months ago

0.0.2

11 months ago

0.0.1

11 months ago