Skip to main content

RESPv2/3 Parser

Works with
This package works with Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Browsers
JSR Score
100%
Published
a month ago (6.0.4)

resp3-parser

Parser for RESP protocol v2/v3

Basic Example

const parser = new Resp3Parser()

const blob = new TextEncoder().encode('+This is a test...\r\n#t\r\n:1234567890\r\n')
parser.appendChunk(blob.subarray(0,9))
parser.appendChunk(blob.subarray(9))

while (parser.remainingBytes > 0) {
    console.log(parser.process())
}

// Outputs:
// This is a test...
// true
// 1234567890

RESP3 Features

Feature Supported
Attributes Yes
Streamed strings Yes
Streamed aggregated data types Yes
Sets Yes
Maps Yes
Verbatim Strings Yes
Blob Errors Yes
Pushes Yes
Big Numbers Yes
Booleans Yes
Doubles Yes
Null Yes
Hello Yes

Types

RESP Javascript
Simple String string
Simple Error Failure
Integer number or bigint
Big Number bigint
Boolean boolean
Double number
Array Array
Null null
Bulk String Bulk or string
Verbatim String FormatedBulk
Bulk Error Failure
Set Unordered
Map Hash
Attributes Hash
Hello Hash
Push Push
Reply with Attributes { reply: unknown, attributes: Hash }
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add @geacko/resp3-parser

Import symbol

import * as mod from "@geacko/resp3-parser";

Add Package

npx jsr add @geacko/resp3-parser

Import symbol

import * as mod from "@geacko/resp3-parser";

Add Package

yarn dlx jsr add @geacko/resp3-parser

Import symbol

import * as mod from "@geacko/resp3-parser";

Add Package

pnpm dlx jsr add @geacko/resp3-parser

Import symbol

import * as mod from "@geacko/resp3-parser";

Add Package

bunx jsr add @geacko/resp3-parser

Import symbol

import * as mod from "@geacko/resp3-parser";