fix: buffer polyfill error

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2022-11-22 13:48:41 +08:00
parent 42d637dd63
commit ac16754c9c

View File

@ -178,7 +178,7 @@ BufferPolyfill.from = function (value, encodingOrOffset, length) {
// Note: Change prototype *after* BufferPolyfill.from is defined to workaround Chrome bug: // Note: Change prototype *after* BufferPolyfill.from is defined to workaround Chrome bug:
// https://github.com/feross/buffer/pull/148 // https://github.com/feross/buffer/pull/148
Object.setPrototypeOf(BufferPolyfill.prototype, Uint8Array.prototype) Object.setPrototypeOf(BufferPolyfill.prototype, Uint8Array.prototype)
Object.setPrototypeOf(Buffer, Uint8Array) Object.setPrototypeOf(BufferPolyfill, Uint8Array)
function assertSize(size) { function assertSize(size) {
if (typeof size !== 'number') { if (typeof size !== 'number') {