NAME
std/data/ini - INI encoding and decoding for ZuzuScript.
SYNOPSIS
from std/data/ini import INI;
let codec := new INI( pretty: true, canonical: true );
let text := codec.encode({
app: {
name: "zuzu",
debug: true,
port: 5000,
},
});
let data := codec.decode(text);
IMPLEMENTATION SUPPORT
This module is supported by zuzu.pl, zuzu-rust, and zuzu-js on Node and Electron. It is partially supported by zuzu-js in the browser: in-memory INI encode/decode coverage passes, but file-backed load/dump coverage is unsupported because browser filesystem capability is unavailable.
DESCRIPTION
This module provides a pure-Zuzu implementation of INI parsing and serialization, with a user-facing API modelled on std/data/json.
EXPORTS
Classes
INI({ utf8?: Bool, pretty?: Bool, canonical?: Bool })Constructs an INI codec. Returns:
INI.codec.encode(value)Parameters:
valueis aDictor compatible mapping. Returns:String. Encodesvalueas INI text.codec.encode_binarystring(value)Parameters:
valueis aDictor compatible mapping. Returns:BinaryString. Encodesvalueas UTF-8 INI bytes.codec.decode(String text)Parameters:
textis INI text. Returns:Dict. Decodes INI text into a dictionary.codec.decode_binarystring(BinaryString bytes)Parameters:
bytesis UTF-8 INI bytes. Returns:Dict. Decodes INI bytes into a dictionary.codec.load(Path path)Parameters:
pathis astd/ioPath. Returns:Dict. Reads INI text frompathand decodes it.codec.dump(Path path, value)Parameters:
pathis astd/ioPathandvalueis aDictor compatible mapping. Returns:null. Encodesvalueand writes INI text topath.
COPYRIGHT AND LICENCE
std/data/ini is copyright Toby Inkster.
It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.