Created
November 22, 2021 12:28
-
-
Save stelf/6004b24cc087a049df0f301e95e26d7d 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 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