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-gzip

v1.4.2

Published

Gzip plugin for gulp.

Downloads

183,183

Readme

gulp-gzip

Gzip plugin for gulp.

Install

npm install --save-dev gulp-gzip

Options

append Boolean

Appends .gz file extension if true. Defaults to true.

 gzip({ append: true })

filename.txt becomes filename.txt.gz.

extension String

Appends an arbitrary extension to the filename. Disables append and preExtension options.

 gzip({ extension: 'zip' }) // note that the `.` should not be included in the extension

filename.txt becomes filename.txt.zip.

preExtension String

Appends an arbitrary pre-extension to the filename. Disables append and extension options.

 gzip({ preExtension: 'gz' }) // note that the `.` should not be included in the extension

filename.txt becomes filename.gz.txt.

threshold String|Number|Boolean

Minimum size required to compress a file. Defaults to false.

gzip({ threshold: '1kb' })
gzip({ threshold: 1024 })
gzip({ threshold: true })

gzipOptions Object

Options object to pass through to zlib.Gzip. See zlib documentation for more information.

gzip({ gzipOptions: { level: 9 } })
gzip({ gzipOptions: { memLevel: 1 } })

deleteMode String|Function

Some webserver modules such as nginx gzip_static looks for example.html.gz, serve it if it exists, else the original example.html will be served.

For instance, if example.html was 2kb, it would be gzipped and example.html.gz was created.

However, if later example.html is modified to content less than the threshold, gulp-gzip will only bypass it. Hence, you will end up with a new example.html yet old example.html.gz. Your webserver will continue to serve old content (example.html.gz).

Using this option, gulp-gzip will remove example.html.gz.

It takes in the same argument as gulp.dest as in gulp.dest('mydest'), so it knows where to look for the gzipped files. Defaults to undefined.

gzip({ threshold: 1024, deleteMode: 'mydest' })

If you have cwd as in gulp.dest('mydest', { cwd: mycwd }). You can configure it using deleteModeCwd.

gzip({ threshold: 1024, deleteMode: 'mydest', deleteModeCwd: mycwd })

skipGrowingFiles Boolean

Some files actually get larger after compression. If true, this option passes along the original, uncompressed file if compression increases the file size. Defaults to false.

 gzip({ skipGrowingFiles : true })

Examples

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

gulp.task('compress', function() {
    gulp.src('./dev/scripts/*.js')
	.pipe(gzip())
	.pipe(gulp.dest('./public/scripts'));
});
var gulp = require('gulp');
var coffee = require('gulp-coffee');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var gzip = require('gulp-gzip');

gulp.task('deployScripts', function() {
	gulp.src('./dev/scripts/*.coffee')
	.pipe(coffee())
	.pipe(concat('all.js'))
	.pipe(uglify())
	.pipe(gzip())
	.pipe(gulp.dest('./public/scripts'));
});
var gulp = require('gulp');
var tar = require('gulp-tar');
var gzip = require('gulp-gzip');

gulp.task('tarball', function() {
	gulp.src('./files/*')
	.pipe(tar('archive.tar'))
	.pipe(gzip())
	.pipe(gulp.dest('.'));
});

More examples.