Created
October 19, 2018 16:39
-
-
Save kellan/8b2b9f8bc8b547ba5f269695fb1374b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const es = require('event-stream'); | |
const stripBom = require('strip-bom'); | |
let filepath = './short.tsv'; | |
let reader = fs.createReadStream(filepath); | |
let keys; | |
reader.pipe(es.split()) | |
.pipe(es.filterSync((line) => {return line})) | |
.pipe(es.mapSync(line => { return stripBom(line)})) | |
.pipe(es.mapSync(line => { | |
row = line.split("\t"); | |
if (!keys) { | |
keys = row; // grab the first line as keys | |
} else { | |
storerow(keys, row); | |
} | |
})); | |
function storerow(keys, row) { | |
//console.log(keys, row); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment