jeudi 16 avril 2015

Node.js transform stream - Find the source name in _transform function

On Windows 7 I have node.js installed, and I am using basic example of Tranform stream to unzip log files in a directory and read log files asynchronously using _transform function. This process is very fast, but now I have a problem: I need to map source filename to the filtered lines. I tried appending filename to the filtered line in on.readable event but its incorrect since data comes out asynchronously from multiple files so maps everything to a single filename. I tried some code like below but this throws error saying too many event listeners created.



source.pipe(gunzip).pipe(liner).pipe(new Upper(filename).pipe(process.stdout));

Aucun commentaire:

Enregistrer un commentaire