API Reference

@iarna/toml

TOML 1.0 parser and serializer for Node.js, used for configuration and Cargo-style manifest files.

Official Documentation ↗
CompatibilityThis documentation covers version v3.0. Check the official docs for the latest API surface.

Installation

npmnpm install @iarna/toml

Methods

@iarna/toml slides between TOML text and plain objects with sync and async file helpers.

Key Features

  • TOML 1.0 with dotted keys and inline tables
  • Native dates and integers
  • parseAsync and readAsync file helpers

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/iarna/iarna-toml@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:50:23.429Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

FAQ

Why use TOML over JSON for config?
TOML has comments, is line-oriented, and has native dates and integers, which is friendlier for hand-edited configuration.
Does it support TOML 1.0?
Yes. @iarna/toml targets the TOML 1.0 specification, including dotted keys and inline tables.
How do I read a TOML file?
Use TOML.parseAsync(readFile(path)) or read the file yourself and pass the string to TOML.parse.