interface Reader {
    get compressed(): boolean;
    get filepath(): string;
    get meta(): Readonly<CardDB.File.Metadata>;
    asStream(options?: CardDB.Stream.StreamOptions): AsyncIterable<Card>;
    diff(
        comparison: CardDB.Stream.Reader,
        streamOptions?: CardDB.Stream.StreamOptions,
    ): Promise<CardDB.Stream.Diff>;
    getAll(): Promise<Card[]>;
    getQuantityMap(
        options?: CardDB.Stream.StreamOptions,
        logger?: BasicLogger,
    ): Promise<Map<string, number>>;
    isCardExportable(card: Card): boolean;
    isCardGroup(card: Card, group: keyof MetadataGroups<string[]>): boolean;
}
Index

Accessors

  • get compressed(): boolean

    Returns boolean

    Whether backing CardDB is compressed.

  • get filepath(): string

    Returns string

    The associated filepath.

Methods

  • Computes a quantity-based diff between this card stream and a comparison card stream instance.

    Cards are compared using a composite identity key (scryfall_id + foil + lang) via uniqueCardKey so that physically distinct printings are treated independently.

    The diff is asymmetric:

    • this card stream instance is treated as the baseline card pool.
    • comparison is treated as the comparison target.

    The result captures:

    • cards newly added in comparison.
    • cards removed since baseline.
    • cards whose quantities changed between the two CardStreams.

    This function is intentionally card-data–light. It operates only on identity keys and quantities. Any card metadata required for reporting should be collected in a subsequent streaming pass.

    Parameters

    Returns Promise<CardDB.Stream.Diff>

    CardStreamDiff object.

  • Return synchronously all card data in the DB.

    Note: Individual entries are not validated for typeof object or the Scryfall object: 'card' association.

    Returns Promise<Card[]>

    All cards in the collection.

  • Builds a quantity map for cards in this card stream.

    Cards are grouped by their composite identity key (scryfall_id + foil + lang), and the quantities of matching entries are summed.

    This method is streaming and memory-efficient: it does not retain card objects, only identity keys and aggregated quantities.

    The returned map is suitable for:

    • diff operations
    • export coalescing
    • analytics and reporting

    Parameters

    Returns Promise<Map<string, number>>

    A map of unique card identity keys to total quantities.

  • Verifies that the card is not part of a non-exportable group. Presently all groups are non-exportable. IE decks, external or proxy.

    Parameters

    Returns boolean

    Whether card can be exported.

  • Checks the meta external file names for a card file name match.

    Parameters

    • card: Card
    • group: keyof MetadataGroups<string[]>

      External card group to test for inclusion.

    Returns boolean

    Whether card is part of given group.