We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Buffer.prototype.base64Slice
1 parent 0489081 commit 09056daCopy full SHA for 09056da
1 file changed
src/main.ts
@@ -22,7 +22,9 @@ export const _bytesToBase64: bytesToBase64Func = /*@__PURE__*/ (
22
? (bytes, omitPadding) => Uint8Array.prototype.toBase64.call(bytes, { omitPadding })
23
: typeof Buffer == 'function' && Buffer.prototype && typeof Buffer.prototype.base64Slice == 'function'
24
? (bytes, omitPadding) => {
25
- const out = Buffer.prototype.base64Slice.call(bytes) as string // has padding
+ // Deno: `Buffer.prototype.base64Slice` throws error when arguments are omitted
26
+ // https://github.com/denoland/deno/issues/34286
27
+ const out = Buffer.prototype.base64Slice.call(bytes, 0, bytes.length) as string // has padding
28
return omitPadding && out.charCodeAt(out.length - 1) === 61
29
//@ts-ignore
30
? out.slice(0, -1 - (out.charCodeAt(out.length - 2) === 61))
0 commit comments