Skip to content

basalt / drives/src / capStream

Function: capStream() ​

> capStream(source, maxBytes): Readable

Defined in: drives/src/fetch.ts:216

Wraps a readable so it errors past maxBytes instead of delivering them.

The source is destroyed on trip, which is what makes an oversized download cost the abandoned prefix rather than the whole file.

Parameters ​

source ​

Readable

maxBytes ​

number

Returns ​

Readable

Released under the MIT License.