iya-sts
    Preparing search index...

    Class export=

    A dataset file, expanded by what it is rather than what it is called: gzip, a single-entry zip, or plain text.

    The one place a dataset file is expanded. The expansion is streamed, never written, and a decompression bomb is refused while still small.

    Index
    RATIO_FLOOR_BYTES: number = RATIO_FLOOR_BYTES

    Below this many expanded bytes the ratio is not asked.

    • Returns how many expanded bytes a file of stored bytes may become: the ratio times its size, at least the floor, at most the cap.

      Parameters

      • stored: number

        the file's size

      • limits: ExpandLimits

        the limits

      Returns number

      the allowance in bytes

    • Reads the first bytes of a file, for sniff().

      Parameters

      • file: string

        the file's path

      Returns Buffer

      the bytes

    • Returns the expansion limits as the settings say now.

      Returns ExpandLimits

      the limits

    • Opens a file for reading, expanded if it is compressed.

      The stream fails with a coded error on a bomb (STS-RISK-0032), an ambiguous archive (STS-RISK-0033) or a corrupt file (STS-RISK-0034).

      Parameters

      • file: string

        the file's path

      • Optionalgiven: ExpandLimits

        the limits; the settings' when omitted

      Returns Promise<Opened>

      { kind, entry, stream, close }, where close() releases the file however reading ended and is safe to call twice

    • Reads a whole file as text, expanded: the FIDO MDS3 BLOB, which is one signed document rather than lines.

      Parameters

      • file: string

        the file's path

      • maxChars: number

        the most characters held; past it the read is refused

      • Optionalgiven: ExpandLimits

        the limits; the settings' when omitted

      Returns Promise<string>

      the text

    • Says what a file's first bytes say it is.

      Parameters

      • head: Buffer

        the file's first bytes

      Returns "plain" | "gzip" | "zip"

      gzip, zip or plain