Skip to content

Commit 8c88e2a

Browse files
authored
Merge pull request #363 from ahippler/main
fix: TypeError: Cannot convert to a BigInt
2 parents 37324cc + 30782e0 commit 8c88e2a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/binding.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ Binding.prototype.realpath = function (filepath, encoding, callback, ctx) {
273273
});
274274
};
275275

276-
function fillStats(stats) {
277-
const target = stats instanceof Float64Array ? statValues : bigintStatValues;
276+
function fillStats(stats, bigint) {
277+
const target = bigint ? bigintStatValues : statValues;
278278
for (let i = 0; i < 36; i++) {
279279
target[i] = stats[i];
280280
}
@@ -303,7 +303,7 @@ Binding.prototype.stat = function (filepath, bigint, callback, ctx) {
303303
throw new FSError('ENOENT', filepath);
304304
}
305305
const stats = item.getStats(bigint);
306-
fillStats(stats);
306+
fillStats(stats, bigint);
307307
return stats;
308308
});
309309
};
@@ -323,7 +323,7 @@ Binding.prototype.fstat = function (fd, bigint, callback, ctx) {
323323
const descriptor = this.getDescriptorById(fd);
324324
const item = descriptor.getItem();
325325
const stats = item.getStats(bigint);
326-
fillStats(stats);
326+
fillStats(stats, bigint);
327327
return stats;
328328
});
329329
};
@@ -1252,7 +1252,7 @@ Binding.prototype.lstat = function (filepath, bigint, callback, ctx) {
12521252
throw new FSError('ENOENT', filepath);
12531253
}
12541254
const stats = item.getStats(bigint);
1255-
fillStats(stats);
1255+
fillStats(stats, bigint);
12561256
return stats;
12571257
});
12581258
};

0 commit comments

Comments
 (0)