node-cooper - v0.2.0
    Preparing search index...

    Class ByteSize

    A CASC byte size (CASC.md ยง6.9) -- 512MiB, 10GB, !bytes("1.5GiB"). Mirrors the Elixir implementation's {:bytes, count}, with the count held as a bigint so that every literal the spec allows (up to PiB/ PB, with any numeral) is represented exactly.

    The closest native JS fit is a plain number: toNumber() (exact up to Number.MAX_SAFE_INTEGER, about 8 PiB) and ByteSize.fromNumber().

    Index
    bytes: bigint
    • Returns string

      the base-unit form, e.g. "536870912B" -- valid CASC if fed back in

    • Parses byte-size literal text ("512MiB"), with the same rules and errors as a bare literal in a CASC file.

      Parameters

      • text: string

      Returns ByteSize