it
    Preparing search index...

    Module it-limit-bytes

    When passed an (async)iterable that yields objects with a .byteLength property, throw if the cumulative value of that property reaches a limit.

    import limitBytes from 'it-limit-bytes'
    import drain from 'it-drain'

    // This can also be an iterator, generator, etc
    const values = [
    Uint8Array.from([0, 1, 2, 3]),
    Uint8Array.from([4, 5, 6, 7])
    ]

    drain(limitBytes(values, 5))
    // throws "Read too many bytes - 8/5"

    Async sources must be awaited:

    import limitBytes from 'it-limit-bytes'
    import drain from 'it-drain'

    // This can also be an iterator, generator, etc
    const values = [
    Uint8Array.from([0, 1, 2, 3]),
    Uint8Array.from([4, 5, 6, 7])
    ]

    await drain(limitBytes(values, 5))
    // throws "Read too many bytes - 8/5"

    Functions

    default