(type, chunk)
| 514 | } |
| 515 | |
| 516 | #decodeBlobString(type, chunk) { |
| 517 | // RESP 2 bulk string null |
| 518 | // https://github.com/redis/redis-specifications/blob/master/protocol/RESP2.md#resp-bulk-strings |
| 519 | if (chunk[this.#cursor] === ASCII['-']) { |
| 520 | this.#cursor += 4; // skip -1\r\n |
| 521 | return null; |
| 522 | } |
| 523 | |
| 524 | const length = this.#decodeUnsingedNumber(0, chunk); |
| 525 | if (typeof length === 'function') { |
| 526 | return this.#continueDecodeBlobStringLength.bind(this, length, type); |
| 527 | } else if (this.#cursor >= chunk.length) { |
| 528 | return this.#decodeBlobStringWithLength.bind(this, length, type); |
| 529 | } |
| 530 | |
| 531 | return this.#decodeBlobStringWithLength(length, type, chunk); |
| 532 | } |
| 533 | |
| 534 | #continueDecodeBlobStringLength(lengthCb, type, chunk) { |
| 535 | const length = lengthCb(chunk); |
no test coverage detected