https://github.com/steelbrain/redis-proto
Redis Protocol Encode/Decode in NodeJS
https://github.com/steelbrain/redis-proto
Last synced: 3 months ago
JSON representation
Redis Protocol Encode/Decode in NodeJS
- Host: GitHub
- URL: https://github.com/steelbrain/redis-proto
- Owner: steelbrain
- License: mit
- Created: 2015-04-04T08:51:40.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-12-13T16:20:01.000Z (over 6 years ago)
- Last Synced: 2025-03-29T06:47:04.276Z (3 months ago)
- Language: JavaScript
- Size: 76.2 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Redis-Proto
==========[](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.