0.0.1-rc.3 • Published 4 months ago

@skgrush/sync-s3 v0.0.1-rc.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@skgrush/sync-s3

Little tool for syncing files into an S3 bucket.

npm.io npm.io npm.io

Expects that all files in the copySourceDirectory should replace all the files in the S3 bucket, and synchronizes them lazily based on MD5 hashes.

The main motivation for this project over AWS's official sync is I wanted to set metadata on specific files and the multi-sync approach made no sense to me.

Usage

env.json

{
  "$schema": "./dist/env.schema.json",
  "region": "us-east-2",
  "bucket": "BUCKET-NAME",
  "credentials": {
    "accessKeyId": "AWS-S3-WRITABLE-KEY-ID",
    "secretAccessKey": "AWS-S3-WRITABLE-ACCESS-KEY"
  },
  "copySourceDirectory": "../dist/MY-PROJECT-NAME/browser",
  "metadataFile": "../metadata.json"
}

metadata.json

{
  "some/file.jpeg": {
    "CacheControl": "no-cache"
  },
  "no-extension": {
    "ContentType": "application/javascript"
  },
  "go-elsewhere": {
    "WebsiteRedirectLocation": "https://github.com/skgrush"
  }
}
npx @skgrush/sync-s3 --execute env.json