@fixers/s3
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

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',
})

Readme

Keywords

Package Sidebar

Install

npm i @fixers/s3

Weekly Downloads

11

Version

0.0.4

License

MIT

Unpacked Size

57.8 kB

Total Files

11

Last publish

Collaborators

  • lucacicada