File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -38,16 +38,15 @@ Stream.Stream = Stream;
38
38
39
39
// Internal utilities
40
40
try {
41
- Stream . _isUint8Array = require ( 'internal/util/types' ) . isUint8Array ;
42
- } catch ( e ) {
43
- // Throws for code outside of Node.js core.
44
-
45
- try {
46
- Stream . _isUint8Array = process . binding ( 'util' ) . isUint8Array ;
47
- } catch ( e ) {
41
+ const types = require ( 'util' ) . types ;
42
+ if ( types && typeof types . isUint8Array === 'function' ) {
43
+ Stream . _isUint8Array = types . isUint8Array ;
44
+ } else {
48
45
// This throws for Node < 4.2.0 because there's no util binding and
49
46
// returns undefined for Node < 7.4.0.
47
+ Stream . _isUint8Array = process . binding ( 'util' ) . isUint8Array ;
50
48
}
49
+ } catch ( e ) {
51
50
}
52
51
53
52
if ( ! Stream . _isUint8Array ) {
Original file line number Diff line number Diff line change @@ -28,9 +28,13 @@ const {
28
28
ERR_ZLIB_INITIALIZATION_FAILED
29
29
} = require ( 'internal/errors' ) . codes ;
30
30
const Transform = require ( '_stream_transform' ) ;
31
- const { _extend } = require ( 'util' ) ;
32
- const { isAnyArrayBuffer } = process . binding ( 'util' ) ;
33
- const { isArrayBufferView } = require ( 'internal/util/types' ) ;
31
+ const {
32
+ _extend,
33
+ types : {
34
+ isAnyArrayBuffer,
35
+ isArrayBufferView
36
+ }
37
+ } = require ( 'util' ) ;
34
38
const binding = process . binding ( 'zlib' ) ;
35
39
const assert = require ( 'assert' ) . ok ;
36
40
const {
You can’t perform that action at this time.
0 commit comments