| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 61261cd commit 61b4a98
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,7 +34,6 @@ const { | |||
| 34 | 34 | ObjectDefineProperties, | |
| 35 | 35 | ObjectDefineProperty, | |
| 36 | 36 | ObjectFreeze, | |
| 37 | - ObjectGetPrototypeOf, | ||
| 38 | 37 | ObjectKeys, | |
| 39 | 38 | ObjectSetPrototypeOf, | |
| 40 | 39 | ReflectApply, | |
@@ -60,7 +59,8 @@ const { | |||
| 60 | 59 | } = require('internal/util'); | |
| 61 | 60 | const { | |
| 62 | 61 | isArrayBufferView, | |
| 63 | - isAnyArrayBuffer | ||
| 62 | + isAnyArrayBuffer, | ||
| 63 | + isUint8Array, | ||
| 64 | 64 | } = require('internal/util/types'); | |
| 65 | 65 | const binding = internalBinding('zlib'); | |
| 66 | 66 | const assert = require('internal/assert'); | |
@@ -109,10 +109,9 @@ for (const ckey of ObjectKeys(codes)) { | |||
| 109 | 109 | function zlibBuffer(engine, buffer, callback) { | |
| 110 | 110 | if (typeof callback !== 'function') | |
| 111 | 111 | throw new ERR_INVALID_ARG_TYPE('callback', 'function', callback); | |
| 112 | - // Streams do not support non-Buffer ArrayBufferViews yet. Convert it to a | ||
| 112 | + // Streams do not support non-Uint8Array ArrayBufferViews yet. Convert it to a | ||
| 113 | 113 | // Buffer without copying. | |
| 114 | - if (isArrayBufferView(buffer) && | ||
| 115 | - ObjectGetPrototypeOf(buffer) !== Buffer.prototype) { | ||
| 114 | + if (isArrayBufferView(buffer) && !isUint8Array(buffer)) { | ||
| 116 | 115 | buffer = Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength); | |
| 117 | 116 | } else if (isAnyArrayBuffer(buffer)) { | |
| 118 | 117 | buffer = Buffer.from(buffer); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments