@openhps/csv
    Preparing search index...

    Interface CSVDataSourceOptions

    interface CSVDataSourceOptions {
        escape?: string;
        headers?: boolean | readonly string[];
        mapHeaders?: (args: { header: string; index: number }) => string;
        mapValues?: (args: { header: string; index: number; value: any }) => any;
        maxRowBytes?: number;
        name?: string;
        newline?: string;
        outputByteOffset?: boolean;
        persistence?: boolean;
        quote?: string;
        raw?: boolean;
        separator?: string;
        skipComments?: string | boolean;
        skipLines?: number;
        source?: DataObject;
        strict?: boolean;
        uid?: string;
    }

    Hierarchy

    • SourceNodeOptions
    • Options
      • CSVDataSourceOptions
    Index
    escape?: string

    A single-character string used to specify the character used to escape strings in a CSV row.

    '"'
    
    headers?: boolean | readonly string[]

    Specifies the headers to use. Headers define the property key for each value in a CSV row. If no headers option is provided, csv-parser will use the first line in a CSV file as the header specification.

    If false, specifies that the first row in a data file does not contain headers, and instructs the parser to use the row index as the key for each row.

    Suppose you have a CSV file data.csv which contains the data:

    NAME,AGE
    Daffy Duck,24
    Bugs Bunny,22

    Using headers: false with the data from data.csv would yield:

    [
    { '0': 'Daffy Duck', '1': 24 },
    { '0': 'Bugs Bunny', '1': 22 }
    ]
    mapHeaders?: (args: { header: string; index: number }) => string

    A function that can be used to modify the values of each header. Return null to remove the header, and it's column, from the results.

    csv({
    mapHeaders: ({ header, index }) => header.toLowerCase()
    });
    mapValues?: (args: { header: string; index: number; value: any }) => any

    A function that can be used to modify the value of each column value.

    csv({
    mapValues: ({ header, index, value }) => value.toLowerCase()
    });
    maxRowBytes?: number

    Maximum number of bytes per row. An error is thrown if a line exeeds this value. The default value is on 8 peta byte.

    Number.MAX_SAFE_INTEGER
    
    name?: string

    User friendly name of the node Used for querying a node by its name.

    newline?: string

    Specifies a single-character string to denote the end of a line in a CSV file.

    '\n'
    
    outputByteOffset?: boolean

    If true, instructs the parser to emit each row with a byteOffset property. The byteOffset represents the offset in bytes of the beginning of the parsed row in the original stream. Will change the output format of stream to be { byteOffset, row }.

    persistence?: boolean

    Merge objects from persisted source

    true
    
    quote?: string

    Specifies a single-character string to denote a quoted string.

    '"'
    
    raw?: boolean

    If true, instructs the parser not to decode UTF-8 strings.

    separator?: string

    Specifies a single-character string to use as the column separator for each row.

    ','
    
    skipComments?: string | boolean

    Instructs the parser to ignore lines which represent comments in a CSV file. Since there is no specification that dictates what a CSV comment looks like, comments should be considered non-standard. The "most common" character used to signify a comment in a CSV file is "#". If this option is set to true, lines which begin with # will be skipped. If a custom character is needed to denote a commented line, this option may be set to a string which represents the leading character(s) signifying a comment line.

    false
    
    skipLines?: number

    Specifies the number of lines at the beginning of a data file that the parser should skip over, prior to parsing headers.

    0
    
    source?: DataObject

    Source data object

    strict?: boolean

    If true, instructs the parser that the number of columns in each row must match the number of headers specified.

    uid?: string

    Manually set the unique identifier of the node