Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: TypeError: Cannot convert to a BigInt #363

Merged
merged 1 commit into from
Aug 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ Binding.prototype.realpath = function (filepath, encoding, callback, ctx) {
});
};

function fillStats(stats) {
const target = stats instanceof Float64Array ? statValues : bigintStatValues;
function fillStats(stats, bigint) {
const target = bigint ? bigintStatValues : statValues;
for (let i = 0; i < 36; i++) {
target[i] = stats[i];
}
Expand Down Expand Up @@ -303,7 +303,7 @@ Binding.prototype.stat = function (filepath, bigint, callback, ctx) {
throw new FSError('ENOENT', filepath);
}
const stats = item.getStats(bigint);
fillStats(stats);
fillStats(stats, bigint);
return stats;
});
};
Expand All @@ -323,7 +323,7 @@ Binding.prototype.fstat = function (fd, bigint, callback, ctx) {
const descriptor = this.getDescriptorById(fd);
const item = descriptor.getItem();
const stats = item.getStats(bigint);
fillStats(stats);
fillStats(stats, bigint);
return stats;
});
};
Expand Down Expand Up @@ -1252,7 +1252,7 @@ Binding.prototype.lstat = function (filepath, bigint, callback, ctx) {
throw new FSError('ENOENT', filepath);
}
const stats = item.getStats(bigint);
fillStats(stats);
fillStats(stats, bigint);
return stats;
});
};
Expand Down