Skip to content

arbre-app/read-gedcom

Repository files navigation

read-gedcom

A Gedcom file reader written in Typescript. See the documentation.

Features

  • Tolerant parsing
    • Character encoding detection (ASCII, CP1252, UTF-8, UTF-16, CP850, and more)
    • Good effort of parsing and interpreting non-standard data
  • Near full specification coverage
    • Mostly Gedcom 5.5.5 compliant while being as much backward compatible as possible
    • Parser for dates in any standard calendars
  • Unopinionated API
    • We provide the API, but the user has full control over the interpretation of the data
    • It's also possible to not use the API, in which case it can be shaken off the tree
  • Strongly typed
  • Zero dependencies; compatible on browser and Node.js
    • Less than 20kB gzipped
  • ...and more:
    • Conversion of dates
    • Serialization-friendly
    • Progress tracking for larger files

Installation and Usage

npm install read-gedcom
import { readGedcom } from 'read-gedcom';

const promise = fetch('https://mon.arbre.app/gedcoms/royal92.ged')
  .then(r => r.arrayBuffer())
  .then(readGedcom);

promise.then(gedcom => {
  console.log(gedcom.getHeader().toString());
});

Or, if you simply want to include it as a javascript file, this is also possible:

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/read-gedcom/dist/read-gedcom.min.js"></script>
<script>
    const promise = fetch('https://mon.arbre.app/gedcoms/royal92.ged')
            .then(r => r.arrayBuffer())
            .then(Gedcom.readGedcom);

    promise.then(gedcom => {
        console.log(gedcom.getHeader().toString());
    });
</script>

Documentation

Bug report

A Gedcom file isn't parsed correctly? Please open a ticket!

Also make sure to attach a zipped version of the bogus Gedcom file. If you don't want to publicly share the file, you may send it to this email address; we will create a minimal reproducible example based on what you sent us, which can be safely shared.