Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
tsctx committed Dec 7, 2023
1 parent 076bb22 commit 3efff25
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/api/readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,18 @@ function consumeEnd (consume) {
case 'json':
resolve(JSON.parse(utf8DecodeBytes(Buffer.concat(body, length))))
break
case 'arrayBuffer':
resolve(Buffer.concat(body, length).buffer)
case 'arrayBuffer': {
const dst = new Uint8Array(length)

let pos = 0
for (const buf of body) {
dst.set(buf, pos)
pos += buf.byteLength
}

resolve(dst.buffer)
break
}
case 'blob':
resolve(new (Blob ??= require('buffer').Blob)(body, { type: stream[kContentType] }))
break
Expand Down

0 comments on commit 3efff25

Please sign in to comment.