encodeSectionStream(stream: ReadableStream<IniSection>): ReadableStream<string>
Encode a stream of INI sections into text lines.
Transforms a stream of IniSection objects into a stream of text lines. Each section is expanded into its header line (if not global) followed by its entry lines.
Encode sections to text lines
Encode sections to text lines
import { encodeSectionStream } from "@hertzg/wg-ini"; import type { IniSection } from "@hertzg/wg-ini/sections"; import { assertEquals } from "@std/assert"; const sections: IniSection[] = [{ section: { $section: "mysection" }, entries: [{ $assign: ["key", "value"] as [string, string], $comment: null }], }]; const stream = ReadableStream.from(sections); const lines = await Array.fromAsync(encodeSectionStream(stream)); assertEquals(lines, ["[mysection]", "key=value"]);
stream: ReadableStream<IniSection>
A readable stream of INI section objects.
ReadableStream<string>
A readable stream of text lines.