Skip to content

Commit d214246

Browse files
committed
More work.
1 parent b4b4358 commit d214246

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Why it might be for you:
1919
Pull one array out of a JSON document larger than memory and tally it — one record at a time, in constant memory:
2020

2121
```js
22-
import chain from 'stream-chain';
2322
import {parser} from 'stream-json';
2423
import {pick} from 'stream-json/filters/pick.js';
2524
import {streamArray} from 'stream-json/streamers/stream-array.js';
25+
import chain from 'stream-chain';
2626
import fs from 'node:fs';
2727

2828
// data.json: { "meta": {...}, "data": [ ...millions of records... ] }
@@ -40,26 +40,23 @@ pipeline.on('data', ({value}) => {
4040
pipeline.on('end', () => console.log(byDepartment));
4141
```
4242
43-
Each stage is a building block; `stream-chain` wires them into one stream and handles the streaming and backpressure. For input straight from a file you can drop `createReadStream` in favor of the Node-only [file edges](https://github.com/uhop/stream-json/wiki/parseFile) (`parseFile()`); to write a token stream back to disk, use [stringerToFile()](https://github.com/uhop/stream-json/wiki/stringerToFile). See [Recipes](https://github.com/uhop/stream-json/wiki/Recipes) for more.
43+
Each stage is a building block; `stream-chain` wires them into one stream and handles the streaming and backpressure. To read straight from a file you can drop `createReadStream` and use the Node-only [parseFile()](https://github.com/uhop/stream-json/wiki/parseFile); to write a stream back to disk, use [stringerToFile()](https://github.com/uhop/stream-json/wiki/stringerToFile). See [Recipes](https://github.com/uhop/stream-json/wiki/Recipes) for more.
4444
4545
## Installation
4646
4747
```bash
4848
npm install --save stream-json
4949
```
5050
51+
ESM only; the current version requires Node 22+ (also runs on Bun and Deno).
52+
5153
## What's in the box
5254
53-
- **[Parser](https://github.com/uhop/stream-json/wiki/Parser)** — the streaming JSON parser producing a SAX-like token stream (optionally packing keys, strings, and numbers). The [main module](https://github.com/uhop/stream-json/wiki/Main-module) decorates it with `emit()`.
54-
- **Filters** — edit a token stream on the fly: [pick](https://github.com/uhop/stream-json/wiki/Pick), [replace](https://github.com/uhop/stream-json/wiki/Replace), [ignore](https://github.com/uhop/stream-json/wiki/Ignore), [filter](https://github.com/uhop/stream-json/wiki/Filter).
55-
- **Streamers** — assemble tokens into JavaScript objects: [streamValues](https://github.com/uhop/stream-json/wiki/StreamValues), [streamArray](https://github.com/uhop/stream-json/wiki/StreamArray), [streamObject](https://github.com/uhop/stream-json/wiki/StreamObject).
56-
- **Essentials** — [Assembler](https://github.com/uhop/stream-json/wiki/Assembler), [Disassembler](https://github.com/uhop/stream-json/wiki/Disassembler), [Stringer](https://github.com/uhop/stream-json/wiki/Stringer), [Emitter](https://github.com/uhop/stream-json/wiki/Emitter).
57-
- **Utilities** &mdash; [emit()](<https://github.com/uhop/stream-json/wiki/emit()>), [withParser()](<https://github.com/uhop/stream-json/wiki/withParser()>), [Batch](https://github.com/uhop/stream-json/wiki/Batch), [Verifier](https://github.com/uhop/stream-json/wiki/Verifier), [FlexAssembler](https://github.com/uhop/stream-json/wiki/FlexAssembler), and Node-only file edges ([parseFile](https://github.com/uhop/stream-json/wiki/parseFile), [stringerToFile](https://github.com/uhop/stream-json/wiki/stringerToFile), [verifyFile](https://github.com/uhop/stream-json/wiki/verifyFile)).
58-
- **[JSONC](https://github.com/uhop/stream-json/wiki/jsonc-Parser)** ([JSON with Comments](https://jsonc.org/)) &mdash; streaming parser, stringer, and verifier, with faithful comma round-trip (`streamCommas` / `useCommas`).
59-
- **JSONL** ([JSON Lines](https://jsonlines.org/)) &mdash; **deprecated**: now a thin re-export of [stream-chain's JSONL](https://github.com/uhop/stream-chain/wiki/jsonl), slated for removal in a future major.
60-
- **Subpaths** &mdash; default `stream-json/...` entries attach both `.asStream` (Node `Duplex`) and `.asWebStream` (Web Streams) to every component; import from `stream-json/web/...` for browser bundles (no Node-stream code in the graph), or `stream-json/core/...` for bare factories. ESM-only, Node 22+.
55+
- **Parsers** &mdash; [JSON](https://github.com/uhop/stream-json/wiki/Parser), [JSONL](https://github.com/uhop/stream-chain/wiki/jsonl) (the fast path for line-delimited data dumps), and [JSONC](https://github.com/uhop/stream-json/wiki/jsonc-Parser) (JSON with comments).
56+
- **Helpers for streamed objects** &mdash; pick out the parts you want, assemble objects from tokens, output JSON back, and read or write files directly.
57+
- **Runtimes** &mdash; works out of the box on Node (Node streams); browser-safe (Web Streams) and dependency-free Core (no streams) builds are there when you need them.
6158
62-
Full documentation is in the **[wiki](https://github.com/uhop/stream-json/wiki)** &mdash; browse the [index](https://github.com/uhop/stream-json/wiki/Home), or [search it](https://uhop.github.io/wiki-search/app/?wiki=uhop/stream-json) by name.
59+
Want the details? Follow the links, or browse the **[wiki](https://github.com/uhop/stream-json/wiki)** &mdash; [index](https://github.com/uhop/stream-json/wiki/Home) or [search](https://uhop.github.io/wiki-search/app/?wiki=uhop/stream-json).
6360
6461
## Companion projects
6562

0 commit comments

Comments
 (0)