-
-
Save TobyEalden/f9219f0b00b9205d9acc8f66a0d3433c to your computer and use it in GitHub Desktop.
This file contains 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 databot = function(input, output, context) { | |
const api = context.tdxApi; | |
let x = 0; | |
const readStream = api.getNDDatasetData( | |
"HygXQFrwx-", // This contains nearly 6 million documents | |
null, | |
null, | |
{limit: 0} | |
); | |
const writeStream = split(JSON.parse, null, {trailing: true}); | |
readStream.on("data", (data) => { | |
console.log(x); | |
x++; | |
}); | |
writeStream.on("end", () => { | |
console.log("done"); | |
}) | |
readStream.on("error", (err) => { | |
console.log("read error %s",err.message); | |
}); | |
writeStream.on("error", (err) => { | |
console.log("read error %s",err.message); | |
}); | |
readStream.pipe(writeStream); | |
} | |
// output | |
... | |
498204 | |
498205 | |
498206 | |
498207 | |
498208 | |
498209 | |
498210 | |
498211 | |
498212 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment