import * as dntShim from "../../../../../_dnt.shims.js"; import type { DelimiterStreamOptions } from "./delimiter_stream.js"; /** * 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 "@std/streams/text-delimiter-stream"; * import { assertEquals } from "@std/assert"; * * 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 "@std/streams/text-delimiter-stream"; * import { assertEquals } from "@std/assert"; * * 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 dntShim.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); } //# sourceMappingURL=text_delimiter_stream.d.ts.map