Skip to content

Instantly share code, notes, and snippets.

@mikehenrty
Created April 26, 2018 17:50
Show Gist options
  • Save mikehenrty/5ffa89ea2c3261fd1bee23c2fa27ee6d to your computer and use it in GitHub Desktop.
Save mikehenrty/5ffa89ea2c3261fd1bee23c2fa27ee6d to your computer and use it in GitHub Desktop.
const readline = require('readline');
const fs = require('fs');
// CHANGE THESE TO INPUT AND OUTPUT FILES
const FILE_PATH = './11k-german-sentences.txt';
const OUTPUT_PATH = './output.csv';
const rl = readline.createInterface({
input: fs.createReadStream(FILE_PATH),
});
const output = fs.createWriteStream(OUTPUT_PATH);
let count = 0;
rl.on('line', (line) => {
output.write(`${++count},${line}\n`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment