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

x/proc/legacy/deps.ts>BufReader#readSlice

A high-level way to run child processes that is easy, flexible, powerful, and prevents resource leaks.
Go to Latest
method BufReader.prototype.readSlice
Re-export
import { BufReader } from "https://deno.land/x/proc@0.20.22/legacy/deps.ts";

readSlice() reads until the first occurrence of delim in the input, returning a slice pointing at the bytes in the buffer. The bytes stop being valid at the next read.

If readSlice() encounters an error before finding a delimiter, or the buffer fills without finding a delimiter, it throws an error with a partial property that contains the entire buffer.

If readSlice() encounters the end of the underlying stream and there are any bytes left in the buffer, the rest of the buffer is returned. In other words, EOF is always treated as a delimiter. Once the buffer is empty, it returns null.

Because the data returned from readSlice() will be overwritten by the next I/O operation, most clients should use readString() instead.

Parameters

delim: number

Returns

Promise<Uint8Array | null>