Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zaro/yaml-document-stream
Work with multi-document YAML as stream
https://github.com/zaro/yaml-document-stream
Last synced: about 1 month ago
JSON representation
Work with multi-document YAML as stream
- Host: GitHub
- URL: https://github.com/zaro/yaml-document-stream
- Owner: zaro
- License: mit
- Created: 2021-01-28T12:25:15.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-28T12:28:59.000Z (almost 4 years ago)
- Last Synced: 2024-11-19T20:08:43.888Z (about 2 months ago)
- Language: TypeScript
- Size: 52.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
YAML multi-document as stream
=============================This is parser/generator for YAML containing multiple documents as streams.
Installation
------------npm -i yaml-document-stream
[js-yaml](https://github.com/nodeca/js-yaml) is a peer dependency, make sure to add it also if not installed already.
Usage
-----Convert YAML stream, to stream of parsed objects
```js
// See example.read.js for full sourcefs.createReadStream('file.yaml').pipe(
new YamlStreamReadTransformer()
)
```Convert stream of objects, to YAML multi-document
```js
// See example.write.js for full sourcestream.Readable.from([{d:1}, {d:2}], {
objectMode: true,
}).pipe(
new YamlStreamWriteTransformer()
).pipe(
process.stdout
)
```Note
----This is not a full streaming parser for YAML, only splitting documents is done in streaming fashion, the single document parsing is done via `js-yaml`