Giter Site home page Giter Site logo

s3's Introduction

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

s3's People

Contributors

lucacicada avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.