@@ -10,6 +10,7 @@ type NodeJsBuffer = ArrayBufferView &
1010 toString : ( this : Uint8Array , encoding : NodeJsEncoding , start ?: number , end ?: number ) => string ;
1111 equals : ( this : Uint8Array , other : Uint8Array ) => boolean ;
1212 swap32 : ( this : NodeJsBuffer ) => NodeJsBuffer ;
13+ compare : ( this : Uint8Array , other : Uint8Array ) => - 1 | 0 | 1 ;
1314 } ;
1415type NodeJsBufferConstructor = Omit < Uint8ArrayConstructor , 'from' > & {
1516 alloc : ( size : number ) => NodeJsBuffer ;
@@ -21,6 +22,7 @@ type NodeJsBufferConstructor = Omit<Uint8ArrayConstructor, 'from'> & {
2122 from ( base64 : string , encoding : NodeJsEncoding ) : NodeJsBuffer ;
2223 byteLength ( input : string , encoding : 'utf8' ) : number ;
2324 isBuffer ( value : unknown ) : value is NodeJsBuffer ;
25+ concat ( list : Uint8Array [ ] ) : NodeJsBuffer ;
2426} ;
2527
2628// This can be nullish, but we gate the nodejs functions on being exported whether or not this exists
@@ -88,6 +90,14 @@ export const nodeJsByteUtils = {
8890 return Buffer . allocUnsafe ( size ) ;
8991 } ,
9092
93+ compare ( a : Uint8Array , b : Uint8Array ) {
94+ return nodeJsByteUtils . toLocalBufferType ( a ) . compare ( b ) ;
95+ } ,
96+
97+ concat ( list : Uint8Array [ ] ) : NodeJsBuffer {
98+ return Buffer . concat ( list ) ;
99+ } ,
100+
91101 equals ( a : Uint8Array , b : Uint8Array ) : boolean {
92102 return nodeJsByteUtils . toLocalBufferType ( a ) . equals ( b ) ;
93103 } ,
0 commit comments