Type-safe JSON streaming parser with progressive data access for Node.js, version 3.2.2. Allows parsing JSON incrementally from streams (e.g., HTTP responses, files) while validating against Zod schemas, enabling early access to parsed data before the full payload is available. Supports async iteration and partial data extraction. Requires Zod as a peer dependency at ^3.23.3. Ships with TypeScript types. Differentiates from generic JSON streaming parsers by integrating schema validation and progressive data access.
npm install schema-streamNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates progressive parsing of a JSON array of users from an HTTP response using a Zod schema.
Upgrade to Node 18+, use async iteration with `createSchemaStream` instead of old `parseStream` callback
Change `import { ... } from 'schema-stream/stream'` to `import { ... } from 'schema-stream'`Always use `for await...of` or sequential async iteration. Do not manually call `.next()` concurrently.
Validate after collection if you need full object integrity, or use schema refinement to require all fields before yielding.
Consume the stream promptly; use backpressure or reduce buffer size if needed.
Change `import createSchemaStream from 'schema-stream'` to `import { createSchemaStream } from 'schema-stream'`Install zod: `npm install zod@^3.23.3` and ensure tsconfig includes 'esModuleInterop' and 'moduleResolution' set to 'node16' or 'bundler'
Switch to ESM (use import statements) or use dynamic import: `const { createSchemaStream } = await import('schema-stream')`