https://github.com/sncegroup/aws-s3-utils
AWS Helper for uploading file to S3 bucket
https://github.com/sncegroup/aws-s3-utils
Last synced: 4 months ago
JSON representation
AWS Helper for uploading file to S3 bucket
- Host: GitHub
- URL: https://github.com/sncegroup/aws-s3-utils
- Owner: SnceGroup
- License: gpl-2.0
- Created: 2020-10-30T15:10:21.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-01-07T09:20:07.000Z (over 4 years ago)
- Last Synced: 2025-05-09T08:38:09.100Z (about 1 year ago)
- Language: JavaScript
- Size: 67.4 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AWS S3 Bucket Utils
[](http://standardjs.com/)
AWS Helper for manage file on AWS S3 bucket, available methods:
- [Upload](#upload)
- [Delete](#delete)
- [Download](#download)
## Requirement
AWS S3 bucket with valid credentials, access key using profile stored in .aws/credentials or using key from .env file
## Installation
Using npm:
```shell
$ npm i -g npm
$ npm i snce-aws-utils
```
## Usage
Require module:
```js
// Load aws-s3-utils.
const snceS3Utils = require('snce-aws-utils');
```
### Module Init
Two different authentication method available for S3:
- `.ENV` file
- AWS `Profile`
#### .ENV
Sample of .env file
```
#FRONTEND LOCAL S3 BUCKET
KEYLOCAL=
BUCKETLOCAL=
SECRETLOCAL=
```
#### Profile
Set profile name and ensure that you already set valid credentials on AWS
### Upload
Upload function to be used: `upload()`
Parameter explanation:
```
* Upload files from given folder on AWS S3 bucket
* @param {string} buildFolder folder to be uploaded.
* @param {string} destinationFolder destination folder on S3 bucket
* @param {string} releaseName name of the release to be used (optional) fallback is the string into MANIFEST file.
* @param {string[]} compressedFileExt list of file extension gzipped in order to set right content encoding value (optional)
* @param {boolean} noReleaseName flag for not using any release name: file will be uploaded directly on root of the bucket (optional)
* @param {string} acl to be used during uploading file (optional: public-read as default)
```
### Delete
Upload function to be used: `delete()`
Parameter explanation:
```
* Delete single file from given AWS S3 bucket
* @param {string} filePath path for the file to be downloaded.
```
### Download
Upload function to be used: `download()`
Parameter explanation:
```
* Download single file from given AWS S3 bucket
* @param {string} filePath path for the file to be downloaded.
```