I'm looking for a way to extract a JAR file (zip) using a gulp task but can't wrap my head around connecting a stream and the unzip.Extract().

Here's the Gulp task I've currently got. It doesn't error out and doesn't actually extract my JAR.

gulp.task('unzip-jar', function(){
    return gulp.src("myjar.jar")
        .pipe(unzip.Extract({ path: './output' }));

});

Thanks for the help.

Edit: Forgot to mention the unzip plugin I am using is https://www.npmjs.org/package/unzip, with the import of:

    unzip = require('unzip'),

This probably isn't necessary but I can't figure out the "correct" way to do this.

有帮助吗?

解决方案

I believe there's no need for a gulp plugin. Just include this in the middle of the pipeline:

.pipe(zlib.createUnzip());

And this at the top:

var zlib = require("zlib");
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top