Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
tsctx authored Aug 12, 2024
1 parent ab9bc40 commit 5cc48ff
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/web/websocket/receiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ class ByteParser extends Writable {
return this.#buffers.shift()
} else {
let offset = 0
// Don't use Buffer.allocUnsafe for a fast-path of toArrayBuffer
// If this is used, extra copies will be made because the offset is non-zero.
// If Buffer.allocUnsafe is used, extra copies will be made because the offset is non-zero.

const buffer = Buffer.allocUnsafeSlow(n)
while (offset !== n) {
const next = this.#buffers[0]
Expand Down Expand Up @@ -316,8 +316,7 @@ class ByteParser extends Writable {
}

let offset = 0
// Don't use Buffer.allocUnsafe for a fast-path of toArrayBuffer
// If this is used, extra copies will be made because the offset is non-zero.
// If Buffer.allocUnsafe is used, extra copies will be made because the offset is non-zero.
const output = Buffer.allocUnsafeSlow(this.#fragmentsBytes)

for (let i = 0; i < fragments.length; ++i) {
Expand Down

0 comments on commit 5cc48ff

Please sign in to comment.