I have a code that replaces in a file all line breaks and sustitute for comma.
var fs = require('fs');
var str = fs.readFile('output.txt', 'utf-8', function(err, data) {
if (err) throw err;
console.log(data.replace(/\r\n/g, ','));
});
I'm trying to make a version that every 3 executions add a line break.
How I can accomplish this?