1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-29 02:29:06 -05:00
denoland-deno/cli/js/web/streams/strategies.ts
crowlKats e435c2be15
Remove doc strings from cli/js TS files (#4329)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-03-13 10:22:22 +01:00

32 lines
844 B
TypeScript

// Forked from https://github.com/stardazed/sd-streams/tree/8928cf04b035fd02fb1340b7eb541c76be37e546
// Copyright (c) 2018-Present by Arthur Langereis - @zenmumbler MIT
/* eslint-disable @typescript-eslint/no-explicit-any */
// TODO reenable this lint here
import { QueuingStrategy } from "../dom_types.ts";
export class ByteLengthQueuingStrategy
implements QueuingStrategy<ArrayBufferView> {
highWaterMark: number;
constructor(options: { highWaterMark: number }) {
this.highWaterMark = options.highWaterMark;
}
size(chunk: ArrayBufferView): number {
return chunk.byteLength;
}
}
export class CountQueuingStrategy implements QueuingStrategy<any> {
highWaterMark: number;
constructor(options: { highWaterMark: number }) {
this.highWaterMark = options.highWaterMark;
}
size(): number {
return 1;
}
}