Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/steelbrain/redis-proto

Redis Protocol Encode/Decode in NodeJS
https://github.com/steelbrain/redis-proto

Last synced: 10 days ago
JSON representation

Redis Protocol Encode/Decode in NodeJS

Awesome Lists containing this project

README

        

Redis-Proto
==========

[![Greenkeeper badge](https://badges.greenkeeper.io/steelbrain/redis-proto.svg)](https://greenkeeper.io/)

A super-lightweight Redis Protocol Encoder and Decoder in Javascript.

## Installation

```
npm install --save redis-proto
```

## Usage

```js
import { encode, decode, decodeGen } from 'redis-proto'

const encoded = encode(['SET', 'KEY', 'VALUE'])
const decoded = decode(encoded)

console.log(decoded[0]) // ['SET', 'KEY', 'VALUE']

for (const entry of decodeGen(encoded)) {
console.log('entry', entry) // ['SET', 'KEY', 'VALUE']
}
```

## API

```js
export function encode(request: any): string
export function decode(content: Buffer | string): Array
export function *decodeGen(content: Buffer | string): Generator

```

## License
This project is licensed under the terms of MIT License. See the LICENSE file for more info.