Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_readFrames(chunk: Buffer): Array {
// Combine partial frame data from previous chunks with the next chunk,
// then extract any complete frames plus any remaining data.
const buffer = Buffer.concat([this._buffer, chunk]);
const [frames, remaining] = deserializeFrames(buffer, this._encoders);
this._buffer = remaining;
return frames;
}