toml-stream-parser
Streaming parser for TOML format. Requires Node v10.0.0 or above.
Usage
The parser takes AsyncIterable (or ReadableStream such as it also implements this interface) as input and returns, also AsyncIterable consisting of TOML chunks separated by inline tables or an array of inline tables:
[person]name = 'John'age = 32 [place]city = 'Novosibirsk'district = 'Academgorodok'
Each inline table will be emitted separately:
const tomlStream = fs for await const chunk of // first chunk will be person // second chunk will be place
Parsing array of tables
If you have some big array of data represented as array of toml tables you can emit direct values of each inline table:
[[people]]name = 'Andrew'age = 32 [[people]]name = 'Alisa'age = 2 [[people]]name = 'Ekaterina'age = 8
Parsing code:
for await of parseTomltoml, // -> Andrew// -> Alisa// -> Ekaterina