mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 20:09:04 +00:00
Adds a new `.jsonl()` method to ReadableStream that returns an async iterable
for parsing newline-delimited JSON (JSONL/NDJSON) streams.
Example usage:
```js
for await (const object of response.body.jsonl()) {
console.log(object);
}
```
The implementation:
- Reads from the stream chunk by chunk as text
- Buffers incomplete lines across chunks
- Parses complete lines as JSON and yields each object
- Handles trailing content without a final newline
- Skips empty/whitespace-only lines
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>