I am would like to be able to filter the output. However, I am having a issue converting from buffer to string. console.log(JSON.stringify(obj.toString())); keeps giving me [object Object] which I can not use. How can I convert the buffer to string so I can filter out the contents to stdout?
//inject 'bower and javascript' files or just 'javascript' files
function injectStream(sourceStream, filesStream) {
sourceStream
.pipe(injector(filesStream, { ignorePath: 'app', addRootSlash: false }))
.pipe(gulp.dest(INDEX_PATH_PARENT))
.pipe(through2.obj(function(obj, enc, next) {
console.log(JSON.stringify(obj.toString()));
this.push(obj.contents);
next();
})).pipe(process.stdout)
}