Skip to content

Latest commit

 

History

History
executable file
·
41 lines (22 loc) · 740 Bytes

README.md

File metadata and controls

executable file
·
41 lines (22 loc) · 740 Bytes

Oresoftare / XML.js

Stream XML and parse to JavaScript objects

Read from a file, or use a readable stream.

import {XMLParser} from '@oresoftware/xml.js'

fs.createReadStream(file).pipe(new XMLParser()).once('result', function(result){
     // your XML is now a JS object
});

Now if you want to stream chunks of JS objects

fs.createReadStream(file).pipe(new XMLParser({key: 'foobar'})).on('jschunk', function(c){
     // represents a Node instance in your data
});

Just pass in a file path:

The library will create a read stream for you.

new XMLParser({file}).once('result', function(c){
     // c represents a Node instance in your data
});