Skip to content

Commit

Permalink
Added compatibility with Gulp@4
Browse files Browse the repository at this point in the history
  • Loading branch information
UlisesGascon committed May 30, 2019
1 parent e4576f1 commit 43311cf
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
const through = require('through2').obj,
const Stream = require('stream'),
through = require('through2').obj,
unzip = require('unzipper'),
Vinyl = require('vinyl');

module.exports = (options = {}) => {


function transform(file, enc, callback){
if (file.isNull()) {
this.push(file);
return callback();
}

let stream = new Stream.PassThrough();

if ( file.isBuffer() && !file.pipe ) {
stream.end( file.contents );
} else {
stream = file;
}

const opts = {};
opts.filter = options.filter || (() => true);
opts.keepEmpty = options.keepEmpty || false;

file.pipe(unzip.Parse())
stream.pipe(unzip.Parse())
.on('entry', entry => {
const chunks = [];
if(!opts.filter(entry)){
Expand Down

0 comments on commit 43311cf

Please sign in to comment.