Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/enviromodder/setup/deps.ts>io.BufReader#peek

A package (in beta) designed to make ReMapper environment statements more friendly
Go to Latest
method io.BufReader.prototype.peek
import { io } from "https://deno.land/x/enviromodder@1.3.2/setup/deps.ts";
const { BufReader } = io;

peek() returns the next n bytes without advancing the reader. The bytes stop being valid at the next read call.

When the end of the underlying stream is reached, but there are unread bytes left in the buffer, those bytes are returned. If there are no bytes left in the buffer, it returns null.

If an error is encountered before n bytes are available, peek() throws an error with the partial property set to a slice of the buffer that contains the bytes that were available before the error occurred.

Parameters

n: number

Returns

Promise<Uint8Array | null>