Skip to content

Commit

Permalink
fix(types): netstring decode
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Apr 30, 2024
1 parent 1d6fa1a commit 90f9302
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/internal/src/netstring.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ export function netstringEncoderStream() {
return new Transform({ transform, writableObjectMode: true });
}

// Input is a Buffer containing zero or more netstrings and maybe some
// leftover bytes. Output is zero or more decoded Buffers, one per netstring,
// plus a Buffer of leftover bytes.
//
/**
*
* @param {Buffer} data containing zero or more netstrings and maybe some
* leftover bytes
* @param {number} [optMaxChunkSize]
* @returns {{ leftover: Buffer, payloads: Buffer[] }} zero or more decoded Buffers, one per netstring,
*/
export function decode(data, optMaxChunkSize) {
// TODO: it would be more efficient to accumulate pending data in an array,
// rather than doing a concat each time
Expand Down

0 comments on commit 90f9302

Please sign in to comment.