Hi everyone,
I'm a newbie in nodejs and express, so i'm trying to generate one CSV file
reading a content of one log file, something like this:
var csv;
var instream = fs.createReadStream(pathLog+req.params.file);
var outstream = new stream;
outstream.readable = true;
outstream.writable = true;
var rl = readline.createInterface({
input: instream,
output: outstream,
terminal: false
});
rl.on('line', function(lin,csv) {
var csv;
if(req.params.id != ''){
var re = new RegExp(req.params.id, 'i');
if(lin.match(re) != null){
var string = lin.substring(143,lin.length);
csv += ','+string;
}
}
});
res.set('Content-Type', 'application/octet-stream');
console.log(csv);
The real problem is, I declared the variable csv and in the event line I'm
incrementing that but in the console.log return undefined.
Thank you!
*Att,*
*Felipe Silveira Mendes*Site <http://felipems.com.br> -
Twitter<https://twitter.com/felipesmendes>-
Blog <http://felipems.com.br/blog>
*Web Developer*
*(31) 8370-9090 (Claro)*
*(31) 9433-9310 (Tim)*
*[email protected] <[email protected]>*
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.