@ferrybig/cgeodata-reader
    Preparing search index...

    Where a reader gets its bytes from. This is what lets a reader honour Section 1.2's goal 2 ("a reader MUST be able to answer a lookup by reading and decompressing only a small, bounded part of the file"): a source is only ever asked for the bytes a lookup needs.

    Reads are asynchronous so that a source can be anything that hands out byte ranges: a file (FileSource in ./node.ts), a Blob or File in a browser, or bytes already in memory. Nothing here depends on Node.js.

    interface ByteSource {
        size: number;
        name?: string;
        read(offset: number, length: number): Promise<Uint8Array<ArrayBufferLike>>;
        close?(): void | Promise<void>;
    }

    Implemented by

    Index
    size: number

    Total size in bytes.

    name?: string

    Shown in error messages about this source, e.g. a file path.

    • length bytes from offset, fewer only where the source ends. The returned bytes may be a view of the source's own memory, so a caller must not modify them.

      Parameters

      • offset: number
      • length: number

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Releases whatever the source holds open, if anything.

      Returns void | Promise<void>