Skip to content

Instantly share code, notes, and snippets.

@stelf
Created November 22, 2021 12:28
Show Gist options
  • Save stelf/6004b24cc087a049df0f301e95e26d7d to your computer and use it in GitHub Desktop.
Save stelf/6004b24cc087a049df0f301e95e26d7d to your computer and use it in GitHub Desktop.
const saxpath = require('./lib/saxpath');
const fs = require('fs');
const zlib = require('zlib');
const sax = require('sax');
const saxParser = sax.createStream(true);
const deflate = zlib.createGunzip();
const fileStream = fs.createReadStream('../discogs_20211101_releases.xml.gz');
const streamer = new saxpath.SaXPath(saxParser, '/releases/release');
streamer.on('match', function(xml) {
console.log('--- matched XML ---');
console.log(xml);
});
fileStream.pipe(deflate).pipe(saxParser);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment