Le source en coffeescript (algorithme c.antunes) fs = require('fs') readlines = (input , func) -> remaining = '' input.on 'data' , (data) -> str = data.toString('ascii') remaining += str index = remaining.indexOf('\n') while (index > -1 ) line = remaining.substring(0 , index ) remaining = remaining.substring(index + 1 ) func line index = remaining.indexOf('\n') input.on 'end' , -> if remaining.length > 0 func remaining input = fs.createReadStream('essai.txt') readlines input , (msg) -> console.log (msg) ############# Le fichier en entrée ############ Eric German vous donne rendez-vous le 19/06/12 aux solutions linux 2012 Le blues des frameworks MVC ############## Son exécution ############# coffee -c lignealigne.coffee german@german-1001PX:~$ node lignealigne.js Eric German vous donne rendez-vous le 19/06/12 aux solutions linux 2012 Le blues des frameworks MVC