asset-pipe-js-reader
Advanced tools
Comparing version 1.0.0-beta.3 to 1.0.0-beta.4
@@ -43,23 +43,29 @@ 'use strict'; | ||
const merged = mergeStream(); | ||
let count = 0; | ||
streams.forEach((strm) => { | ||
strm.on('error', (error) => { | ||
this.emit('error', error); | ||
}); | ||
strm.on('file found', (file) => { | ||
this.emit('file found', file); | ||
merged.add(strm.pipe(JSONStream.parse('*'))); | ||
count++; | ||
if (count === streams.length) { | ||
if (merged.isEmpty()) { | ||
this.emit('pipeline empty'); | ||
} else { | ||
this.emit('pipeline ready'); | ||
} | ||
} | ||
}); | ||
strm.on('file not found', (file) => { | ||
this.emit('file not found', file); | ||
count++; | ||
if (count === streams.length) { | ||
if (merged.isEmpty()) { | ||
this.emit('pipeline empty'); | ||
} else { | ||
this.emit('pipeline ready'); | ||
} | ||
} | ||
}); | ||
}); | ||
// If the merged file stream yelded empty, we can not continue | ||
setImmediate(() => { | ||
if (merged.isEmpty()) { | ||
return this.emit('pipeline empty'); | ||
} | ||
this.emit('pipeline ready'); | ||
}); | ||
// Set up the pipeline | ||
@@ -81,3 +87,4 @@ const order = new Order(); | ||
.pipe(this); | ||
} | ||
}; |
{ | ||
"name": "asset-pipe-js-reader", | ||
"version": "1.0.0-beta.3", | ||
"version": "1.0.0-beta.4", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "Trygve Lie", |
7001
77