UNPKG

@brimdata/zealot

Version:

The Javascript Client for Zed Lakes

16 lines (13 loc) 391 B
import {parse} from "./parse" import {NEW_LINE, pipeJson} from "./pipe_json" import {pipeText} from "./pipe_text" export async function* eachLine( readable: ReadableStream<Uint8Array> | NodeJS.ReadableStream | null ) { for await (let json of pipeJson(pipeText(readable))) { yield json } } export function parseLines(string: string) { return string.split(NEW_LINE).map(parse) }