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

x/wmill/deps.ts>DelimiterStream

Open-source developer platform to turn scripts into workflows and UIs. Fastest workflow engine (5x vs Airflow). Open-source alternative to Airplane and Retool.
Go to Latest
class DelimiterStream
extends TransformStream<Uint8Array, Uint8Array>
import { DelimiterStream } from "https://deno.land/x/wmill@v1.308.1/deps.ts";

Divide a stream into chunks delimited by a given byte sequence.

Examples

Divide a CSV stream by commas, discarding the commas:

import { DelimiterStream } from "https://deno.land/std@0.224.0/streams/delimiter_stream.ts";
const res = await fetch("https://example.com/data.csv");
const parts = res.body!
  .pipeThrough(new DelimiterStream(new TextEncoder().encode(",")))
  .pipeThrough(new TextDecoderStream());

Divide a stream after semi-colons, keeping the semi-colons in the output:

import { DelimiterStream } from "https://deno.land/std@0.224.0/streams/delimiter_stream.ts";
const res = await fetch("https://example.com/file.js");
const parts = res.body!
  .pipeThrough(
    new DelimiterStream(
      new TextEncoder().encode(";"),
      { disposition: "suffix" },
    )
  )
  .pipeThrough(new TextDecoderStream());

Constructors

new
DelimiterStream(delimiter: Uint8Array, options?: DelimiterStreamOptions)