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

way2enjoy-gulp

v1.0.1

Published

Way2enjoy API wrapper for compressing JPG, PNG, GIF images as well as PDF, MP3,MP4. All video & audio files are supported

Downloads

4

Readme

way2enjoy-gulp

Way2enjoy API wrapper for compressing JPG, PNG & GIF images, Audio & Video files

Install

Requires node 0.10.x or above

Install with npm - In your project folder, run:

npm install way2enjoy-gulp

To run tests:

npm test

Example

var gulp = require('gulp');
var way2enjoy = require('way2enjoy-gulp');

gulp.task('way2enjoy', function () {
	gulp.src('images/src/**/*.{png,jpg,jpeg}')
		.pipe(way2enjoy({
			key: 'API_KEY',
			sigFile: 'images/.way2enjoy-sigs',
			log: true
		}))
		.pipe(gulp.dest('images'));
});

API

Way2enjoy([options])

Returns Stream containing compressed images

options

Type: Object / String Default: false

Sets options described below from its properties. If type is not object, string presumed (the API key)

options.key

Type: String Default: ''

Your Way2enjoy API key to use for requests

options.sigFile

Type: String Default: ''

If set to a filename, it will compare existing source file md5 signatures against those found in the file's json data. When the signatures match, the file is skipped from being minified again, allowing you to better stay within your API request limits. When an image is minified, the md5 signature is determined from the unminified source image and written to the file at options.sigFile (a suggested location would be somewhere under your source control).

Signatures are based off the unminified source image, so that when the source changes it will be re-minified and re-written to the destination file.

options.sameDest

Type: Boolean Default false

If your source is the same as your destination (images are written over themselves), and you want to use the signature checking feature, set this to true

Note: If your source and destination are the same, it's recommended you use this, and options.sigFile, as it prevents you from continually uploading already compressed images each time you run the task

options.summarize/summarise

Type: Boolean Default: false

Outputs statistics once all images have been handled.

[09:47:43] way2enjoy-gulp Skipped: 0 images, Compressed: 1 image, Savings: 3.98 KB (ratio: 0.4109)

options.log

Type: Boolean Default: false

Set to true to log errors & messages to the console. Errors are dispatched via events anyway, so plugins like gulp-plumber can handle these for you.

options.parallel

Type: Boolean Default: true

Enables concurrent uploads to the way2enjoy server to speed up total compression time.

(thanks Way2enjoy2 for this feature suggestion)

options.parallelMax

Type: Integer Default: 5

The amount of concurrent uploads allowed at one time, increase if you/your request limits can handle it - very easy to max out your monthly requests, use with caution!

options.force

Type: Boolean / String Default: false

Force compress images regardless of signature. Value can either be true to force all images, or a glob pattern string to match against the filename(s).

Can also be performed from the command line:

$ gulp png --force 'icon-*.png'

This feature was added as it's impossible to know where the files are being written to at this point in the stream, unless the directory is directly passed into the config (pretty ugly). So the option was added to force certain (or all) files to be compressed when required.

options.ignore

Type: Boolean / String Default: false

Same as options.force except ignores files if the glob is matched

--ignore flag on the command line

Deprecated/non-functional options

options.checkSigs - Removed in favor of options.sigFile

License

MIT © Way2enjoy - Way2enjoy.com.

Original license:

MIT © Gaurav Jassal