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

    Class FtReader

    High-level reader for fielded text files. Provides a convenient API for reading CSV and other delimited/fixed-width text. This is a thin wrapper around SerializationReader with simpler constructors.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    • Create a reader with or without metadata. If metadata is provided, it will be loaded immediately. If not, you must call loadMeta() before reading. You must call open() before reading.

      Parameters

      • Optionalmeta: FtMeta

        The metadata defining the file structure

      Returns FtReader

    • Create a reader with metadata and input text. You must call open() before reading.

      Parameters

      • meta: FtMeta

        The metadata defining the file structure

      • input: string

        The text content to read

      • OptionalimmediatelyReadHeader: boolean

        Whether to automatically read header lines (default: true)

      Returns FtReader

    • Create a reader with metadata and a TextReader.

      Parameters

      • meta: FtMeta

        The metadata defining the file structure

      • textReader: FtTextReader

        The TextReader to read from

      • OptionalimmediatelyReadHeader: boolean

        Whether to automatically read header lines (default: true)

      Returns FtReader

    • Create a reader with input text but no metadata. You must call loadMeta() before reading.

      Parameters

      • input: string

        The text content to read

      • OptionalimmediatelyReadHeader: boolean

        Whether to automatically read header lines (default: true)

      Returns FtReader

    • Create a reader with a TextReader but no metadata. You must call loadMeta() before reading.

      Parameters

      • textReader: FtTextReader

        The TextReader to read from

      • OptionalimmediatelyReadHeader: boolean

        Whether to automatically read header lines (default: true)

      Returns FtReader

    Properties

    _recordCount: number = 0
    _tableCount: number = 0
    onFieldHeadingReadReady?: (args: FtFieldHeadingReadyEventArgs) => void
    onFieldHeadingWriteReady?: (args: FtFieldHeadingReadyEventArgs) => void
    onFieldValueReadReady?: (args: FtFieldValueReadyEventArgs) => void
    onFieldValueWriteReady?: (args: FtFieldValueReadyEventArgs) => void
    onHeadingLineFinished?: (args: FtHeadingLineFinishedEventArgs) => void
    onHeadingLineStarted?: (args: FtHeadingLineStartedEventArgs) => void
    onRecordFinished?: (args: FtRecordFinishedEventArgs) => void
    onRecordSeeked: OnRecordSeeked | undefined = undefined

    Event fired when seeking through records.

    onRecordStarted?: (args: FtRecordStartedEventArgs) => void
    onRequireFileMetaAsText: OnRequireFileMetaAsText | undefined = undefined

    Event fired when needing to access file to get meta. This library is browser-compatible and does not have direct file system access, so this event allows the consumer to provide file content as text.

    onRequireUrlMetaAsText: OnRequireUrlMetaAsText | undefined = undefined

    Event fired when needing to access URL to get meta. Deferred to consumer as need to handle encoding and also must be returned synchronously

    onSequenceRedirected?: (args: FtSequenceRedirectedEventArgs) => void
    CarriageReturnChar: "\r" = CharReader.CarriageReturnChar
    CarriageReturnLineFeedString: "\r\n" = CharReader.CarriageReturnLineFeedString
    LineFeedChar: "\n" = CharReader.LineFeedChar
    PrefixSpaceChar: " " = ' '
    Signature: "|!Fielded Text^|" = CharReader.Signature
    VersionLabel: "Version" = 'Version'
    VersionMajor: 1
    VersionMinor: 1
    VersionSeparator: "." = '.'

    Accessors

    Methods

    • Open the reader with a text string.

      Parameters

      • textReaderOrText: string | FtTextReader

        Text reader or string providing the data to read

      • immediatelyReadHeader: boolean = true

        Whether to automatically read header lines (default: true)

      Returns void