File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
+ const fsBinding = process . binding ( 'fs' ) ;
4
+ const statsConstructor = fsBinding . statValues
5
+ ? fsBinding . statValues . constructor
6
+ : Float64Array ;
7
+ // Nodejs v18.7.0 changed bigint stats type from BigUint64Array to BigInt64Array
8
+ // https://github.com/nodejs/node/pull/43714
9
+ const bigintStatsConstructor = fsBinding . bigintStatValues
10
+ ? fsBinding . bigintStatValues . constructor
11
+ : BigUint64Array ;
12
+
3
13
let counter = 0 ;
4
14
5
15
/**
@@ -280,7 +290,9 @@ Item.prototype.setGid = function(gid) {
280
290
* @return {Object } Stats properties.
281
291
*/
282
292
Item . prototype . getStats = function ( bigint ) {
283
- const stats = bigint ? new BigUint64Array ( 36 ) : new Float64Array ( 36 ) ;
293
+ const stats = bigint
294
+ ? new bigintStatsConstructor ( 36 )
295
+ : new statsConstructor ( 36 ) ;
284
296
const convert = bigint ? v => BigInt ( v ) : v => v ;
285
297
286
298
stats [ 0 ] = convert ( 8675309 ) ; // dev
You can’t perform that action at this time.
0 commit comments