Function size

  • Utility for defining bytes

    Type Parameters

    • Amount extends number
    • Factor extends 1000 | 1024 = 1024

    Parameters

    Returns Size<Amount, Factor>

    Example

    import { size } from "@rjweb/utils"

    size(10).mb() // 10485760
    size(10, 1000).mb() // 10000000

    Since

    1.6.0

    Supports

    nodejs, browser

    Default

    factor = 1024