Skip to content

feat: implement ReadableStream and URL/HTTP input support - #27

Merged
bytebrujo merged 1 commit into
mainfrom
feature/stream-url-input
Feb 7, 2026
Merged

bytebrujo merged 1 commit into
mainfrom
feature/stream-url-input

Conversation

@bytebrujo

Copy link
Copy Markdown
Owner

Summary

  • Implements ReadableStream input: consumes stream chunks, concatenates, and feeds to Zig parser via buffer
  • Implements URL input: detects http:///https:// URLs, uses fetch() to download, parses response as buffer
  • Adds download: boolean config flag for explicit URL mode
  • Adds load() async method for explicit initialization of URL/stream sources
  • Async iterator (for await...of) auto-calls load() — no explicit call needed
  • Sync iterator throws a helpful error if load() wasn't called for async sources
  • load() is idempotent — safe to call multiple times

Test plan

  • Parses from single-chunk ReadableStream
  • Parses from multi-chunk ReadableStream (data split across chunks)
  • Async iterator auto-loads from ReadableStream
  • Sync iterator throws helpful error without load() for stream
  • Fetches and parses from HTTP URL
  • Async iterator auto-loads from URL
  • download: true flag treats string as URL
  • Throws on HTTP error (404)
  • load() is idempotent
  • All 37 existing + new tests pass

Closes #10

🤖 Generated with Claude Code

Add async loading for URL and ReadableStream sources. URLs (http/https)
are fetched with fetch(), ReadableStreams are consumed and buffered.
The async iterator auto-loads; sync iterator requires explicit
await parser.load() first. Adds download option flag for explicit
URL mode.

Closes #10

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bytebrujo
bytebrujo force-pushed the feature/stream-url-input branch from 534326b to 9ea6906 Compare February 7, 2026 05:46
@bytebrujo
bytebrujo merged commit bad924a into main Feb 7, 2026
4 of 5 checks passed
@bytebrujo
bytebrujo deleted the feature/stream-url-input branch February 7, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement ReadableStream and URL/HTTP input support

1 participant