MCPcopy
hub / github.com/redis/node-redis / #decodeStringWithLength

Method #decodeStringWithLength

packages/client/lib/RESP/decoder.ts:545–564  ·  view source on GitHub ↗
(length, skip, type, chunk)

Source from the content-addressed store, hash-verified

543 }
544
545 #decodeStringWithLength(length, skip, type, chunk) {
546 const end = this.#cursor + length;
547 if (end >= chunk.length) {
548 const slice = chunk.subarray(this.#cursor);
549 this.#cursor = chunk.length;
550 return this.#continueDecodeStringWithLength.bind(
551 this,
552 length - slice.length,
553 [slice],
554 skip,
555 type
556 );
557 }
558
559 const slice = chunk.subarray(this.#cursor, end);
560 this.#cursor = end + skip;
561 return type === Buffer ?
562 slice :
563 slice.toString();
564 }
565
566 #continueDecodeStringWithLength(length, chunks, skip, type, chunk) {
567 const end = this.#cursor + length;

Callers 1

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected