Encode Redis commands to the RESP wire format or decode raw RESP bytes back to readable values. Supports RESP2 types: simple strings, errors, integers, bulk strings, arrays, and null.
| Prefix | Type | Example |
|---|---|---|
+ | Simple String | +OK\r\n |
- | Error | -ERR unknown command\r\n |
: | Integer | :1000\r\n |
$ | Bulk String | $5\r\nhello\r\n ($-1\r\n = null) |
* | Array | *2\r\n$3\r\nfoo\r\n$3\r\nbar\r\n (*-1\r\n = null) |
Commands are always encoded as RESP arrays of bulk strings. In command-input mode, quote arguments with spaces using "..." or '...'. Use \n for actual newlines inside quoted arguments.