File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22const zstd = require ( 'bindings' ) ( 'zstd' ) ;
33const { promisify } = require ( 'util' ) ;
4- const { isArrayBufferView } = require ( 'util/types' ) ;
4+ const { isUint8Array } = require ( 'util/types' ) ;
55
66const _compress = promisify ( zstd . compress ) ;
77const _decompress = promisify ( zstd . decompress ) ;
88// Error objects created via napi don't have JS stacks; wrap them so .stack is present
99// https://github.com/nodejs/node/issues/25318#issuecomment-451068073
1010
1111exports . compress = async function compress ( data , compressionLevel ) {
12- const isUint8Array = isArrayBufferView ( data ) && data instanceof Uint8Array ;
13- if ( ! isUint8Array ) {
12+ if ( ! isUint8Array ( data ) ) {
1413 throw new TypeError ( `parameter 'data' must be a Uint8Array.` ) ;
1514 }
1615
@@ -25,8 +24,7 @@ exports.compress = async function compress(data, compressionLevel) {
2524 }
2625} ;
2726exports . decompress = async function decompress ( data ) {
28- const isUint8Array = isArrayBufferView ( data ) && data instanceof Uint8Array ;
29- if ( ! isUint8Array ) {
27+ if ( ! isUint8Array ( data ) ) {
3028 throw new TypeError ( `parameter 'data' must be a Uint8Array.` ) ;
3129 }
3230 try {
You can’t perform that action at this time.
0 commit comments