gsu

gulp-s3-util

A plugin for Gulp that provides AWS s3 utilities.

Showing:

Popularity

Downloads/wk

5

GitHub Stars

0

Maintenance

Last Commit

7yrs ago

Contributors

10

Package

Dependencies

3

Size (min+gzip)

53.3KB

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

gulp-s3-util NPM version build status

s3 plugin for gulp

What can it do?

Use it to create a CDN for your website. Currently it copies files from a local destination to your AWS s3 bucket. Other updates and features are planned.

Usage

First, install gulp-s3-util as a development dependency:

npm install --save-dev gulp-s3-util

Setup your aws.json file

{
  "key": "AKIAI3Z7CUAFHXXXXXXX",
  "secret": "acYxWRu5RRa6CwzQuhdXEfTpbQA+1XQJ7XXXXXXX",
  "bucket": "dev.example.com",
  "region": "eu-west-1"
}

Then, use it in your gulpfile.js:

var s3 = require("gulp-s3-util");

aws = JSON.parse(fs.readFileSync('./aws.json'));
gulp.src('./dist/**')
    .pipe(s3(aws));

API

options.headers

Type: Array
Default: []

Headers to set to each file uploaded to S3

var options = { headers: {'Cache-Control': 'max-age=315360000, no-transform, public'} }
gulp.src('./dist/**')
    .pipe(s3(aws, options));

options.gzippedOnly

Type: Boolean
Default: false

Only upload files with .gz extension, additionally it will remove the .gz suffix on destination filename and set appropriate Content-Type and Content-Encoding headers.

var gulp = require("gulp");
var s3 = require("gulp-s3-util");
var gzip = require("gulp-gzip");
var options = { gzippedOnly: true };

gulp.src('./dist/**')
.pipe(gzip())
.pipe(s3(aws, options));

});

options.uploadPath

Type: String Default: ''

S3 prefix to add to each uploaded file.

var options = { uploadPath: '/dev/assets/' }
gulp.src('./dist/**')
    .pipe(s3(aws, options));

options.asyncLimit

Type: Number Default: 4

Limits the number of concurrent uploads to S3.

var options = { asyncLimit: 8 }
gulp.src('./dist/**')
    .pipe(s3(aws, options));

License

MIT License

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100