0.1.1 • Published 7 years ago

@mapbox/wikidata-changes-stream v0.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
7 years ago

wikidata-changes-stream

Create node streams of change event objects from Wikidata's RecentChanges API.

createChangeStream()

Create a stream of change event objects from Wikidata.

createEntityStream()

Transform stream that requests full entities from change event objects.

Example

Stream the last 60 seconds of changes from Wikidata.

var wcs = require('wikidata-changes-stream');

var changes = wcs.createChangeStream({
    start: (+new Date)/1000 - 60,
    end: (+new Date)/1000
});

changes
    .pipe(wcs.createEntityStream())
    .on('data', function(obj) {
        console.log(JSON.stringify(obj));
    })
    .on('error', function(err) {
        console.error(err);
    });