ioredis 5.0.5 → 5.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -102,13 +102,13 @@ Medis starts with all the basic features you need:
102
102
  ## Install
103
103
 
104
104
  ```shell
105
- $ npm install ioredis
105
+ npm install ioredis
106
106
  ```
107
107
 
108
108
  In a TypeScript project, you may want to add TypeScript declarations for Node.js:
109
109
 
110
110
  ```shell
111
- $ npm install --save-dev @types/node
111
+ npm install --save-dev @types/node
112
112
  ```
113
113
 
114
114
  ## Basic Usage
@@ -312,19 +312,27 @@ listenForMessage();
312
312
 
313
313
  ## Handle Binary Data
314
314
 
315
- Arguments can be buffers:
315
+ Binary data support is out of the box. Pass buffers to send binary data:
316
316
 
317
317
  ```javascript
318
- redis.set("foo", Buffer.from("bar"));
318
+ redis.set("foo", Buffer.from([0x62, 0x75, 0x66]));
319
319
  ```
320
320
 
321
- And every command has a method that returns a Buffer (by adding a suffix of "Buffer" to the command name).
322
- To get a buffer instead of a utf8 string:
321
+ Every command that returns a [bulk string](https://redis.io/docs/reference/protocol-spec/#resp-bulk-strings)
322
+ has a variant command with a `Buffer` suffix. The variant command returns a buffer instead of a UTF-8 string:
323
323
 
324
324
  ```javascript
325
- redis.getBuffer("foo", (err, result) => {
326
- // result is a buffer.
327
- });
325
+ const result = await redis.getBuffer("foo");
326
+ // result is `<Buffer 62 75 66>`
327
+ ```
328
+
329
+ It's worth noticing that you don't need the `Buffer` suffix variant in order to **send** binary data. That means
330
+ in most case you should just use `redis.set()` instead of `redis.setBuffer()` unless you want to get the old value
331
+ with the `GET` parameter:
332
+
333
+ ```javascript
334
+ const result = await redis.setBuffer("foo", "new value", "GET");
335
+ // result is `<Buffer 62 75 66>` as `GET` indicates returning the old value.
328
336
  ```
329
337
 
330
338
  ## Pipelining
@@ -1388,7 +1396,7 @@ default, this option is disabled and can only be used for debugging purposes. Yo
1388
1396
  Start a Redis server on 127.0.0.1:6379, and then:
1389
1397
 
1390
1398
  ```shell
1391
- $ npm test
1399
+ npm test
1392
1400
  ```
1393
1401
 
1394
1402
  `FLUSH ALL` will be invoked after each test, so make sure there's no valuable data in it before running tests.
@@ -26,3 +26,6 @@ declare class Pipeline extends Commander<{
26
26
  addBatch(commands: any): this;
27
27
  }
28
28
  export default Pipeline;
29
+ interface Pipeline {
30
+ length: number;
31
+ }
@@ -9,6 +9,7 @@ export interface ResultTypes<Result, Context> {
9
9
  export interface ChainableCommander extends RedisCommander<{
10
10
  type: "pipeline";
11
11
  }> {
12
+ length: number;
12
13
  }
13
14
  export declare type ClientContext = {
14
15
  type: keyof ResultTypes<unknown, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ioredis",
3
- "version": "5.0.5",
3
+ "version": "5.0.6",
4
4
  "description": "A robust, performance-focused and full-featured Redis client for Node.js.",
5
5
  "main": "./built/index.js",
6
6
  "types": "./built/index.d.ts",