Skip to main content
Module

x/jsonlines/mod.ts>JSONLinesStringifyStream

Web stream based jsonlines decoder/encoder
Latest
class JSONLinesStringifyStream
extends TransformStream<unknown, string>
import { JSONLinesStringifyStream } from "https://deno.land/x/jsonlines@v1.2.2/mod.ts";

stream to stringify JSON lines, NDJSON and JSON Text Sequences.

import { readableStreamFromIterable } from "https://deno.land/std@0.185.0/streams/mod.ts";
import { JSONLinesStringifyStream } from "https://deno.land/x/jsonlines@v1.2.1/mod.ts";

const file = await Deno.open(new URL("./tmp.concat-json", import.meta.url), {
  create: true,
  write: true,
});

readableStreamFromIterable([{ foo: "bar" }, { baz: 100 }])
  .pipeThrough(new JSONLinesStringifyStream())
  .pipeThrough(new TextEncoderStream())
  .pipeTo(file.writable)
  .then(() => console.log("write success"));

Constructors

new
JSONLinesStringifyStream(options?: StringifyStreamOptions)