Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream bz xml file #62

Open
leojoubert opened this issue Apr 28, 2016 · 2 comments
Open

stream bz xml file #62

leojoubert opened this issue Apr 28, 2016 · 2 comments

Comments

@leojoubert
Copy link

Hi,

I need to parse wikipedia dumps for research purpose. The dumps are very very big (much more than 1TB). These are the file "page-meta-history.xml" -> http://dumps.wikimedia.org
So I can't unzip the file. Can I word with bz file into the xml-steam API ?

Thank you

@jbielick
Copy link

jbielick commented May 21, 2016

You can pipe the read stream into an unzip transformer and then pass the stream to XmlStream.

try this:

const request = require('request');
const zlib = require('zlib');

let readStream = request('http://dumps.wikimedia.org/some-dump.xml').pipe(zlib.createGunzip());
let parser  = new XmlStream(readStream);

@cigolpl
Copy link

cigolpl commented Jun 8, 2016

@cafeine05 you can try this https://github.com/spencermountain/wikipedia-to-mongodb for doing whole job

In very short decompressing bz in stream has such a logic:

  var bz2 = require('unbzip2-stream');
  var stream = fs.createReadStream(file).pipe(bz2());
  var stream = fs.createReadStream(file);
  var xml = new XmlStream(stream);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants