0.1.0 • Published 7 years ago

gedstream v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Gedstream

Parse a GEDCOM file as a stream

Install

$ npm install gedstream

Example

Create a new stream and pipe a file into it

var Gedstream = require('gedstream'),
    fs        = require('fs');

let gedstream = new Gedstream();
fs.createReadStream('/path/to/gedcom').pipe(gedstream);

gedstream.on('data', function onData(tag) {
    // Root tag objects will be emitted here
    // These are of instance `Tag`, but can be jsonified
    /*
        Tag {
            level   : 0,
            tag     : "INDI",
            pointer : "@I18@",
            data    : "",
            tree    : [ ... ],
            parent  : null
        }
    */
});

You can also directly pass a filepath

var Gedstream = require('gedstream');

let gedstream = Gedstream.fromFile('/path/to/gedcom');

gedstream.on('data', function onData(tag) {
    // ...
});