function decodeTextStream
decodeTextStream(stream: ReadableStream<string>): ReadableStream<IniSection>

Decode a text stream into INI sections.

Transforms a stream of text chunks into a stream of IniSection objects. The text is first split into lines, then parsed into INI line objects, and finally grouped into sections.

Examples

Decode a text stream

import { decodeTextStream } from "@hertzg/wg-ini";
import { assertEquals } from "@std/assert";

const text = "[section]\nkey=value\n";
const stream = ReadableStream.from([text]);
const sections = await Array.fromAsync(decodeTextStream(stream));

assertEquals(sections.length, 1);
assertEquals(sections[0].section?.$section, "section");

Parameters

stream: ReadableStream<string>

A readable stream of text chunks.

Return Type

A readable stream of INI section objects.

Usage

import { decodeTextStream } from "mod.ts";