npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-s3-replace

v0.1.3

Published

Upload files to Amazon S3 of the IMG, A, LINK and SCRIPT tags and replaces the url for gulp 3.

Downloads

12

Readme

gulp-s3-replace

Upload files to Amazon S3 of the IMG, A, LINK and SCRIPT tags and replaces the url for gulp 3.

Usage

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

npm install gulp-s3-replace --save-dev

Then, add it to your gulpfile.js:

var s3Replace = require('gulp-s3-replace');

gulp.task('s3replace', function(){
  gulp.src(['./views/*.html'])
    .pipe(s3Replace({
      basePath: './',
      bucketName: 's3 bucket name',
      fileExtensions: ['jpg', 'pdf'],
      s3: {
        s3Options: {
          accessKeyId: 'your s3 key',
          secretAccessKey: 'your s3 secret'
        }
      }
    }))
    .pipe(gulp.dest('build/views'));
});

Api

Upload files to Amazon S3 of the IMG, A, LINK and SCRIPT tags and replaces the url.

s3Replace(options)

gulp-replace options

options

Type: Object

options.basePath

Type: string
Default: process.cwd()

Base path for files.

options.bucketName

Type: string
Default: empty

The bucket that the files will be uploaded to.

options.fileExtensions

Type: array
Default: ['jpg', 'png', 'gif', 'svg', 'doc', 'pdf', 'js', 'css']

File extensions to be uploaded.

options.s3.multipartUploadThreshold

Type: integer
Default: 20971520

If a file is this many bytes or greater, it will be uploaded via a multipart request. Minimum is 5MB. Maximum is 5GB.

options.s3.multipartUploadThreshold

Type: integer
Default: 15728640

When uploading via multipart, this is the part size. The minimum size is 5MB. The maximum size is 5GB. Note that S3 has a maximum of 10000 parts for a multipart upload, so if this value is too small, it will be ignored in favor of the minimum necessary value required to upload the file.

options.s3.maxAsyncS3

Type: integer
Default: 20

Maximum number of simultaneous requests this client will ever have open to S3.

options.s3.s3RetryCount

Type: integer
Default: 3

How many times to try an S3 operation before giving up.

options.s3.s3RetryDelay

Type: integer
Default: 1000

How many milliseconds to wait before retrying an S3 operation.

options.s3.s3Options.accessKeyId

Type: string
Default: empty

Your Amazon S3 key.

options.s3.s3Options.secretAccessKey

Type: string
Default: empty

Your Amazon S3 secret key.

More s3Options options see:http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#constructor-property

Note

Before uploading files plugin creates a meta file (in the directory specified in options.basePath) the current time, so as not upload files that have not changed. If you want to upload files forcibly remove the meta directory.

Testing

S3_KEY=<valid_s3_key> S3_SECRET=<valid_s3_secret> S3_BUCKET=<valid_s3_bucket> npm test

The test timeout is set to 40 seconds because Internet connectivity waries wildly.