jstuckey / gulp-gzip

Gzip plugin for gulp.
MIT License
175 stars 17 forks source link

Support for compression level #6

Closed tyke closed 10 years ago

tyke commented 10 years ago

Would love support for compression level

jstuckey commented 10 years ago

Sure. I'll add an options object that will get passed directly to the gzip stream. That way compression level, chunkSize, etc. can all be set for gzip.

KyivJunta commented 10 years ago

I had implemented those options in my pr, but then just realised that its pointless - default level (6) is most balanced on speed/compression.

jstuckey commented 10 years ago

Think it's worth adding? I don't see the harm in making the option available.

KyivJunta commented 10 years ago

Actualy i started pr with that problem in mind, but never used it. Its worth, its just couple of locs. Actually i used custom zlib properties once - i had busy logining infrastructure (.5-2m insert/s), and had to put logs in queue with bulk compression. Ive set Z_SYNC_FLUSH and cranked up memLevel, but that was an edge case.

eggbit commented 10 years ago

I'd welcome support for a compression level option, too.

jstuckey commented 10 years ago

Thanks for the input. I'm in the process of adding this feature. Should be out today or tomorrow.

tyke commented 10 years ago

Thanks!

jstuckey commented 10 years ago

I added a gzipOptions config in version 0.0.8. This can be used to pass any of the usual options to zlib.Gzip

Example:

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

var config = {
    gzipOptions: {
        level: 9,
        memLevel: 9
    },
    append: true
};

gulp.task('default', function() {
    gulp.src('...')
        .pipe(gzip(config))
        .pipe(gulp.dest('...'));
});