stream-size
Version:
Get the size of a stream and abort it if threshold is reached
11 lines (10 loc) • 485 B
TypeScript
/// <reference types="node" />
import { Transform } from 'stream';
export declare type StreamWithSize = Transform & {
sizeInBytes: number;
};
/**
* @param maximumSizeInBytesAllowed Optional. Set this parameter to the maximum amount of bytes before throwing an error and closing the stream. Leave unset to allow any amount of bytes and not apply any limit.
*/
declare function getSizeTransform(maximumSizeInBytesAllowed?: number): StreamWithSize;
export default getSizeTransform;