Module

x/postgres/deps.ts>BufReader#readSlice

PostgreSQL driver for Deno
Extremely Popular
Go to Latest
method BufReader.prototype.readSlice
import { BufReader } from "https://dotland.deno.dev/x/postgres@v0.17.2/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>