feat(cli): memory-efficient streaming for encoding

This commit is contained in:
Johann Schopplich
2025-11-21 14:02:22 +01:00
parent be8bcfe9b2
commit 1c003c6118
7 changed files with 308 additions and 50 deletions

View File

@@ -764,6 +764,19 @@ console.log(encode(data))
// 2,Bob,user
```
**Streaming large datasets:**
```ts
import { encodeLines } from '@toon-format/toon'
const largeData = await fetchThousandsOfRecords()
// Memory-efficient streaming for large data
for (const line of encodeLines(largeData)) {
process.stdout.write(`${line}\n`)
}
```
## Playgrounds
Experiment with TOON format interactively using these community-built tools for token comparison, format conversion, and validation: