Created
October 10, 2016 22:34
-
-
Save chrislaughlin/72db8ad161f3d063ecee48ab3f437705 to your computer and use it in GitHub Desktop.
Print the name and description of 50 transactions from the npm repo stream
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 ChangesStream = require('changes-stream'); | |
const db = 'https://replicate.npmjs.com'; | |
var changes = new ChangesStream({ | |
db: db, | |
include_docs: true | |
}); | |
let count = 0; | |
changes.on('data', function(change) { | |
if (count > 50) { | |
process.exit(0); | |
} | |
const { name, | |
description, | |
} = change.doc; | |
console.log('-------------'); | |
console.log(name); | |
console.log(description); | |
console.log('-------------'); | |
count++; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment