stringifyObject(obj: Record<string, Record<string, unknown>>): Promise<string>
Convert an object to an INI string.
Since it takes an object, it does not support duplicate keys or sections. This is the reverse of parseObject and uses stringifyArray under the hood.
Global properties (entries before any section header) should be stored under
the empty string key "".
Stringify object to INI
Stringify object to INI
import { stringifyObject } from "@hertzg/wg-ini"; import { assertEquals } from "@std/assert"; const obj = { "": { global_key: "global_value" }, mysection: { key1: "1", key2: "2" }, }; assertEquals(await stringifyObject(obj), [ "global_key=global_value", "", "[mysection]", "key1=1", "key2=2", "", ].join("\n"));