How to use the optipng-bin.stream function in optipng-bin

To help you get started, we’ve selected a few optipng-bin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imagemin / imagemin / index.js View on Github external
Imagemin.prototype._optimizePng = function () {
    var args = ['-strip', 'all', '-quiet'];
    var optipng = require('optipng-bin').stream;
    var pngquant;

    if (typeof this.optimizationLevel === 'number') {
        args.push('-o', this.optimizationLevel);
    }

    if (this.opts.pngquant) {
        pngquant = require('pngquant-bin').path;
        return spawn(optipng, args).stdout.pipe(spawn(pngquant, ['-']));
    }

    return spawn(optipng, args);
};

optipng-bin

OptiPNG wrapper that makes it seamlessly available as a local dependency

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular optipng-bin functions