Registry / database / redisparse

redisparse

JSON →
library0.2.1jsnpmunverified

A lightweight streaming parser for Redis responses, version 0.2.1. Unlike buffer-based parsers, redisparse processes each chunk independently without buffering incomplete data, making it suitable for streaming environments. Its API follows the event-driven pattern of node_redis but adds support for partial replies. Currently in early development (single-digit minor version), not widely adopted, with infrequent releases.

npm install redisparse
INSTALL
IMPORT
SIG · REDISPARSE
R
redisparse
databasejavascriptv0.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Parser
import { Parser } from 'redisparse'
const Parser = require('redisparse').Parser;
ESM only; CommonJS patterns not supported.
Parser (default)
import Parser from 'redisparse'
const Parser = require('redisparse');
Default export is also available in ESM.
Parser type
import type { Parser } from 'redisparse'
import { Parser } from 'redisparse';
Use type import if only using type, though regular import also works at runtime.

Create a Parser, attach event listeners for replies and errors, execute RESP data.

import { Parser } from 'redisparse'; const parser = new Parser(); parser.on('reply', (result) => { console.log('Reply:', result); }); parser.on('reply partial', (result) => { console.log('Partial reply:', result); }); parser.on('reply error', (err) => { console.error('Redis error:', err); }); parser.on('error', (err) => { console.error('Parse error:', err); }); // Simulate a Redis RESP message const data = Buffer.from('+OK\r\n'); parser.execute(data);
Debug
Known issues
gotchaParser does not buffer incomplete chunks; an incomplete RESP chunk will not emit any 'reply' event and will be silently ignored.
fix
Ensure you provide complete RESP chunks or implement your own buffering logic when using the parser.
affects: >=0.0.0
gotchaMultiple 'reply' events may be emitted for a single command if partial replies are received (e.g., large arrays streamed in parts).
fix
Listen to 'reply partial' to track partial results and accumulate final reply when 'reply' is emitted without a prior partial.
affects: >=0.0.0
gotchaNo default import; developer must destructure { Parser } from the module.
fix
Use correct import: import { Parser } from 'redisparse'.
affects: >=0.0.0
gotchaThe library does not export any TypeScript types. Use with caution if type safety is required.
fix
Write your own ambient declarations or use 'any'.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: require(...).Parser is not a function
Trying CommonJS require on an ESM-only package.
fix
Use dynamic import: const { Parser } = await import('redisparse');
import Parser from 'redisparse'; throws SyntaxError: Unexpected token import
Running code as CommonJS (no ESM support) or using outdated Node.js.
fix
Add type: 'module' in package.json, or use .mjs extension, or upgrade Node to >=13.2.
node:internal/modules/cjs/loader:582 throw ERR_REQUIRE_ESM
Using require() on an ESM package without using dynamic import.
fix
Use import() or switch to ESM context.
Cannot find module 'redisparse'
Package not installed or typo in import path.
fix
Run 'npm install redisparse' and verify the import statement.
Upgrade
Version history
0.2.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
redisparse — npm install redisparse · libregistry