FieldedText TypeScript Library - v0.1.2
    Preparing search index...

    FieldedText TypeScript Library - v0.1.2

    Fielded Text TypeScript Library (for web)

    NPM version License

    This library allows you to parse and generate CSV like text data in manner similar to reading and writing from/to databases. It does this by associating a schema (called Meta) with the text data.

    The structure of this meta/schema is specified by the proposed Fielded Text standard. Note that this standard is not limited to CSV data but handles a wide variety of text data where lines consist of field values. For example it can also be used with lines having fixed width fields and also with lines containing different fields based on the value of key fields.

    Below is a very simple parsing example:

    import { FtReader, FtXmlMetaSerialization } from "@pbkware/fielded-text-web";

    // CSV data to be read
    const csvData = `Name,Age
    John Doe,30
    Jane Smith,25`;

    // Meta describing the schema of the CSV data
    const xmlMeta = `<?xml version="1.0" encoding="utf-8"?>
    <FieldedText HeadingLineCount="1">
    <Field Name="Name"/>
    <Field Name="Age" DataType="Integer"/>
    </FieldedText>`;

    // Load meta data from XML
    const metaReader = new FtXmlMetaSerialization();
    const meta = metaReader.deserialize(xmlMeta);

    const reader = new FtReader(meta, csvData);

    // Read and log the data
    while (reader.read()) {
    console.log(
    reader.fieldList.get(0).asString,
    reader.fieldList.get(1).asBigInt,
    );
    }
    npm install @pbkware/fielded-text-web