An implementation of the REdis Serialization Protocol (RESP) for Node.js. Version 4.2.0 is stable, with infrequent releases. It provides encoding and decoding of RESP data (simple strings, errors, integers, bulk strings, arrays, nulls) as buffers. Key differentiators: low-level protocol handling, stream-based parsing, and support for pipelining. Unlike higher-level Redis clients, respjs focuses solely on the wire protocol, making it suitable for building custom Redis clients or tools. It is a dependency of thunk-redis and other libraries.
npm install respjsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to use respjs to parse RESP data from a TCP socket to a Redis server, sending a PING command.
Always pipe a stream or provide complete RESP chunks; use resp.write() only when you have full frames.
Use encodeBulk for data strings, encodeString for simple reply strings like 'OK'.
Pass { bufBulk: true } in the constructor to get Buffer objects for bulk data.Use encodeNullArray() for RESP null arrays (*-1\r\n) instead of encodeNull().
Use require('respjs') or use default import with esModuleInterop in TypeScript.Ensure you are writing complete RESP frames; consider using a stream and pipe instead.
Wrap arguments in an array: Resp.encodeRequest(['set', 'key', value]).
No dependency data recorded yet.