Here's the reference solution: var fs = require('fs'); var txt = fs.readFileSync('$WAKE_FILE', 'utf8'); var sprintf = require('sprintf'); var lines = txt.split('\n'); lines.forEach(function (line, index) { if (index % 5 === 0) { console.log(sprintf('%3d %s', index, line)); } else { console.log(' ' + line); } }); We use brfs to inline that `fs.readFileSync()` call and then we walk over each of the lines in the file, printing leading line numbers with some help from sprintf. There are tons of transforms on npm for doing just about whatever you need! Check out the list here: https://npmjs.org/browse/keyword/browserify-transform