Giter Site home page Giter Site logo

imclab / s3-publish Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dhcole/s3-publish

0.0 2.0 0.0 156 KB

Simple node.js application that syncs a local directory with a bucket on S3. Applies cache control and compression.

JavaScript 100.00%

s3-publish's Introduction

s3-publish

Simple node.js application that syncs a local directory with a bucket on S3.

Makes serving a static website from S3 easy, especially when used with CloudFront for SSL.

Worked by checking a list of remote s3 objects, comparing them with local files in a specified directory, removing files on s3 but not in the folder, and uploading new or replacing other files. Adds a caching header and applies gzip compression to specified files.

configuration

Set configuration as a json file:

{
  "bucket": "my.s3.bucket.name",
  "directory": "/path/to/my/website/_site",
  "compress": "html|css|js|json",
  "cache": "max-age=60"
}
  • bucket an S3 bucket
  • directory local directory to sync with bucket
  • compress regex match for files to apply gzip compression
  • cache Cache-control header value

Uses the AWS Javascript SDK, so it reads your AWS credentials from environment variables or a local file. See more here.

install and run

Run with the config file path (e.g. ~/path-to/config.json) as an argument.

$ npm install
$ node app.js [config file]

s3-publish's People

Contributors

dhcole avatar

Watchers

 avatar  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.