Skip to content

Commit 6ffb4c6

Browse files
jmathewpaulmillr
andauthored
Update check for fs.stat/fs.lstat bigint support. (#171)
* Update check for fs.stat/fs.lstat bigint support. Fix: #170 * Update index.js * Update index.js * Update index.js Co-authored-by: Paul Miller <[email protected]>
1 parent 62eea1a commit 6ffb4c6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ const EVERYTHING_TYPE = 'all';
3030
const ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE];
3131

3232
const isNormalFlowError = error => NORMAL_FLOW_ERRORS.has(error.code);
33+
const [maj, min] = process.versions.node.split('.').slice(0, 2).map(n => Number.parseInt(n, 10));
34+
const wantBigintFsStats = process.platform === 'win32' && (maj > 10 || (maj === 10 && min >= 5));
3335

3436
const normalizeFilter = filter => {
3537
if (filter === undefined) return;
@@ -92,7 +94,7 @@ class ReaddirpStream extends Readable {
9294

9395
const statMethod = opts.lstat ? lstat : stat;
9496
// Use bigint stats if it's windows and stat() supports options (node 10+).
95-
if (process.platform === 'win32' && stat.length === 3) {
97+
if (wantBigintFsStats) {
9698
this._stat = path => statMethod(path, { bigint: true });
9799
} else {
98100
this._stat = statMethod;

0 commit comments

Comments
 (0)