Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/io/readers.ts>LimitedReader

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
class LimitedReader
implements [Deno.Reader]
import { LimitedReader } from "https://deno.land/std@0.67.0/io/readers.ts";

A LimitedReader reads from reader but limits the amount of data returned to just limit bytes. Each call to read updates limit to reflect the new amount remaining. read returns null when limit <= 0 or when the underlying reader returns null.

Constructors

new
LimitedReader(reader: Deno.Reader, limit: number)

Methods

read(p: Uint8Array): Promise<number | null>