Function toArrayOrThrow

  • By default, reads all the values from source, or until 5 seconds has elapsed.

    If limit is provided as an option, it will exit early, or throw if that number of values was not acheived.

    // Read from `source` for 5 seconds
    const data = await toArrayOrThrow()(source);
    // Read 5 items from `source`
    const data = await toArrayOrThrow({ limit: 5 })(source);
    // Read for 10s
    const data = await toArrayOrThrow({ maximumWait: 10_1000 })(source);

    Type Parameters

    • V

    Parameters

    Returns Promise<V[]>