lib/algorithms/png.js
function _compress(command, outputFile) {
    return qexec(command)
        .then(function () {
            return outputFile.loadSize();
        })
        .fail(function (err) {
            // Before using of 'advpng' a raw file has to be copied
            // This algorithm can not compress a file and write a result to another file
            return qfs.exists(outputFile.name)
                .then(function (exists) {
                    if (exists) {
                        outputFile.remove();
                    }

                    throw err;
                });
        });
}
function _compress(command, outputFile) {
    return qexec(command)
        .then(function () {
            return outputFile.loadSize();
        })
        .fail(function (err) {
            // Before using of 'advpng' a raw file has to be copied
            // This algorithm can not compress a file and write a result to another file
            return qfs.exists(outputFile.name)
                .then(function (exists) {
                    if (exists) {
                        outputFile.remove();
                    }

                    throw err;
                });
        });
}
function _compress ( command , outputFile ) { return qexec ( command ) . then ( function ( ) { return outputFile . loadSize ( ) ; } ) . fail ( function ( err ) { // Before using of 'advpng' a raw file has to be copied // This algorithm can not compress a file and write a result to another file return qfs . exists ( outputFile . name ) . then ( function ( exists ) { if ( exists ) { outputFile . remove ( ) ; } throw err ; } ) ; } ) ; }
Executes the given compression command and returns the instace of the compressed file
@param {String} command
@param {File} outputFile
@returns {Promise * File}
Executes the given compression command and returns the instace of the compressed file