2.0.1 • Published 6 years ago

s3-directory-upload v2.0.1

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

s3 directory upload

Script to upload directory (all folders and files in it) to a S3 bucket by using official Amazon SDK.

AWS Credentials

In order to use this module, you'll need to have AWS Credentials. You can load them, two ways:

  • By passing directly to the method as second parameter.
  • By having a .env file with the credentials. The ENV variables are ACCESS_KEY_ID, SECRET_ACCESS_KEY and BUCKET_NAME.

Install

npm install s3-directory-upload -S

In case you want to use the CLI, you can install it globally:

npm install -g s3-directory-upload

Require

const upload = require('s3-directory-upload')
// ES6: import s3UploadDirectory from 's3-directory-upload'

const directoryName = 'static'

const credentials = {
  "host": "<Custom host to upload directory>", // [optional], default Amazon Host
  "accessKeyId": "<Your Access Key Id>",
  "secretAccessKey": "<Your Secret Access Key>",
  "bucketName": "<Your Bucket Name>"
}
const deleteExistingFilesInBucket = true; // default false

upload(directoryName, credentials, deleteExistingFilesInBucket)

CLI

$ s3-directory-upload <directory>

Example:
$ s3-directory-upload static

For the AWS Credentials you need a ENV variables called ACCESS_KEY_ID, SECRET_ACCESS_KEY and BUCKET_NAME in .env file.

! If you use CLI to upload files they will be added without deleting existing files in the bucket.

! CLI does not support host changing

2.0.1

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago