|
27 | 27 | const {
|
28 | 28 | Map,
|
29 | 29 | MathMax,
|
| 30 | + Number, |
30 | 31 | NumberIsSafeInteger,
|
31 | 32 | ObjectCreate,
|
32 | 33 | ObjectDefineProperties,
|
@@ -174,7 +175,10 @@ const isFd = isUint32;
|
174 | 175 | function isFileType(stats, fileType) {
|
175 | 176 | // Use stats array directly to avoid creating an fs.Stats instance just for
|
176 | 177 | // our internal use.
|
177 |
| - return (stats[1/* mode */] & S_IFMT) === fileType; |
| 178 | + let mode = stats[1]; |
| 179 | + if (typeof mode === 'bigint') |
| 180 | + mode = Number(mode); |
| 181 | + return (mode & S_IFMT) === fileType; |
178 | 182 | }
|
179 | 183 |
|
180 | 184 | function access(path, mode, callback) {
|
@@ -1614,7 +1618,7 @@ function realpathSync(p, options) {
|
1614 | 1618 |
|
1615 | 1619 | const baseLong = pathModule.toNamespacedPath(base);
|
1616 | 1620 | const ctx = { path: base };
|
1617 |
| - const stats = binding.lstat(baseLong, false, undefined, ctx); |
| 1621 | + const stats = binding.lstat(baseLong, true, undefined, ctx); |
1618 | 1622 | handleErrorFromBinding(ctx);
|
1619 | 1623 |
|
1620 | 1624 | if (!isFileType(stats, S_IFLNK)) {
|
@@ -1747,7 +1751,7 @@ function realpath(p, options, callback) {
|
1747 | 1751 | return process.nextTick(LOOP);
|
1748 | 1752 | }
|
1749 | 1753 |
|
1750 |
| - return fs.lstat(base, gotStat); |
| 1754 | + return fs.lstat(base, { bigint: true }, gotStat); |
1751 | 1755 | }
|
1752 | 1756 |
|
1753 | 1757 | function gotStat(err, stats) {
|
|
0 commit comments