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

x/proc/tools/deps/proc.ts>toByteLines

A better way to work with processes in Deno.
Go to Latest
function toByteLines
import { toByteLines } from "https://deno.land/x/proc@0.21.9/tools/deps/proc.ts";

Convert an AsyncIterable<Uint8Array> into an AsyncIterable<Uint8Array[]> (an array of lines chunked together based on buffer size) split on lf and also suppressing trailing cr.

lf and trailing cr is removed from the returned lines. As this is line-oriented data, if the last line is empty (the last byte was a line feed, splitting into one extra line), it is suppressed.

Implementation attempts to minimize object creation.

Parameters

buffs: AsyncIterable<Uint8Array>

The iterable bytes.

Returns

AsyncIterable<Uint8Array[]>