1.0.1 • Published 1 year ago

s3wrap v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

npm version

s3wrap

A simple wrapper around the AWS SDK for S3

Prerequisites

This project requires NodeJS (version 14 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.

$ npm -v && node -v

Environment Variables

Please make sure you have the following environment variables set:

AWS_S3_BUCKET_NAME=your-bucket-name
AWS_REGION=your-region
AWS_ACCESS_KEY_ID=your-access-key-id
AWS_SECRET_ACCESS_KEY=your-secret-access-key
AWS_S3_ENDPOINT=your-s3-endpoint

CDN

If you want to use CDN, please make sure you use same bucket name for Domain Name and Bucket Name.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Installation

BEFORE YOU INSTALL: please read the prerequisites

Start with cloning this repo on your local machine:

$ git clone https://github.com/dodysat/s3wrap.git
$ cd s3wrap

To install and set up the library, run:

$ npm install --save s3wrap

Or if you prefer using Yarn:

$ yarn add s3wrap

Usage

checkFileExist

const { checkFileExist } = require("s3wrap");

const params = {
  Bucket: "bucket-name",
  Key: "file-location",
};

const result = await checkFileExist(params);

generatePresignedUrlUpload

generatePresignedUrlUploadPublic

uploadFileFromBody

uploadFileFromFs

getPresignedUrl

getPublicCdnUrl

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Add your changes: git add .
  4. Commit your changes: git commit -am 'Add some feature'
  5. Push to the branch: git push origin my-new-feature
  6. Submit a pull request :sunglasses:

Built With

  • NPM - Dependency Management
  • Node.js - JavaScript runtime

Authors

See also the list of contributors who participated in this project.

License

MIT License © Dody Satria

1.0.1

1 year ago

1.0.0

1 year ago