You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-8Lines changed: 5 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
8
8
A high performance javascript redis parser built for [node_redis](https://github.com/NodeRedis/node_redis) and [ioredis](https://github.com/luin/ioredis).
9
9
10
-
Generally all [RESP](http://redis.io/topics/protocol) data will be properly parsed by the parser.
10
+
All [RESP](http://redis.io/topics/protocol) data is parsed by this parser.
11
11
12
12
## Install
13
13
@@ -22,7 +22,7 @@ npm install redis-parser
22
22
```js
23
23
var Parser =require('redis-parser');
24
24
25
-
newParser(options);
25
+
var myParser =newParser(options);
26
26
```
27
27
28
28
### Possible options
@@ -31,7 +31,6 @@ new Parser(options);
31
31
*`returnError`: *function*; mandatory
32
32
*`returnFatalError`: *function*; optional, defaults to the returnError function
33
33
*`returnBuffers`: *boolean*; optional, defaults to false
34
-
*`stringNumbers`: *boolean*; optional, defaults to false
35
34
36
35
### Example
37
36
@@ -69,7 +68,7 @@ You do not have to use the returnFatalError function. Fatal errors will be retur
69
68
70
69
And if you want to return buffers instead of strings, you can do this by adding the `returnBuffers` option.
71
70
72
-
If you handle big numbers, you should pass the `stringNumbers` option. That case numbers above 2^53 can be handled properly without reduced precision.
71
+
Big numbers that are too large for JS are automatically stringified.
73
72
74
73
```js
75
74
// Same functions as in the first example
@@ -81,7 +80,6 @@ var parser = new Parser({
81
80
returnError:function(err) {
82
81
lib.returnError(err);
83
82
},
84
-
stringNumbers:true, // Return all numbers as string instead of a js number
85
83
returnBuffers:true// All strings are returned as buffer e.g. <Buffer 48 65 6c 6c 6f>
86
84
});
87
85
@@ -90,12 +88,11 @@ var parser = new Parser({
90
88
91
89
## Protocol errors
92
90
93
-
To handle protocol errors (this is very unlikely to happen) gracefully you should add the returnFatalError option, reject any still running command (they might have been processed properly but the reply is just wrong), destroy the socket and reconnect. Be aware that while doing this, no new command may be added, so all new commands have to be buffered in the meanwhile.
94
-
Otherwise a chunk might still contain partial data of a following command that was already processed properly but answered in the same chunk as the command that resulted in the protocol error.
91
+
To handle protocol errors (this is very unlikely to happen) gracefully you should add the returnFatalError option, reject any still running command (they might have been processed properly but the reply is just wrong), destroy the socket and reconnect. Note that while doing this no new command may be added, so all new commands have to be buffered in the meantime, otherwise a chunk might still contain partial data of a following command that was already processed properly but answered in the same chunk as the command that resulted in the protocol error.
95
92
96
93
## Contribute
97
94
98
-
The parser is already optimized but there are likely further optimizations possible.
95
+
The parser is highly optimized but there may still be further optimizations possible.
0 commit comments