0.1.0 • Published 7 years ago

node-gedcom v0.1.0

Weekly downloads
2
License
MIT
Repository
-
Last release
7 years ago

node-gedcom

Allows parsing a GEDCOM file record-by-record.

Installation

yarn add node-gedcom

Usage

import fs from 'fs';
import GedcomParser from 'gedcom-stream';

const parser = new GedcomParser();
parser.on('record', record => console.log(record));

parser.process(fs.createReadStream('/path/to/your.ged'));

Which would yield each record in the GEDCOM file:

{
    "level": 0,
    "type": "INDI",
    "data": "I0001",
    "children": [
        {
            "level": 1,
            "type": "NAME",
            "data": "Abraham /Lincoln/",
            "children": []
        },
        {
            "level": 1,
            "type": "SEX",
            "data": "M",
            "children": []
        },
        {
            "level": 1,
            "type": "BIRT",
            "data": null,
            "children": [
                {
                    "level": 2,
                    "type": "DATE",
                    "data": "12 Feb 1809",
                    "children": []
                },
                {
                    "level": 2,
                    "type": "PLAC",
                    "data": "Hodgenville, Kentucky",
                    "children": []
                }
            ]
        }
    ]
}