import type { DelimiterStreamOptions } from "./delimiter_stream.ts"; /** * Transform a stream `string` into a stream where each chunk is divided by a * given delimiter. * * If you are working with a stream of `Uint8Array`, consider using {@linkcode DelimiterStream}. * * If you want to split by a newline, consider using {@linkcode TextLineStream}. * * @example Comma-separated values * ```ts * import { TextDelimiterStream } from "text_delimiter_stream.ts"; * import { assertEquals } from "../assert/mod.ts"; * * const stream = ReadableStream.from([ * "alice,20,", * ",US,", * ]); * * const valueStream = stream.pipeThrough(new TextDelimiterStream(",")); * * assertEquals( * await Array.fromAsync(valueStream), * ["alice", "20", "", "US", ""], * ); * ``` * * @example Semicolon-separated values with suffix disposition * ```ts * import { TextDelimiterStream } from "text_delimiter_stream.ts"; * import { assertEquals } from "../assert/mod.ts"; * * const stream = ReadableStream.from([ * "const a = 42;;let b =", * " true;", * ]); * * const valueStream = stream.pipeThrough( * new TextDelimiterStream(";", { disposition: "suffix" }), * ); * * assertEquals( * await Array.fromAsync(valueStream), * ["const a = 42;", ";", "let b = true;", ""], * ); * ``` */ export declare class TextDelimiterStream extends TransformStream { #private; /** * Constructs a new instance. * * @param delimiter A delimiter to split the stream by. * @param options Options for the stream. */ constructor(delimiter: string, options?: DelimiterStreamOptions); }