We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
blksize
blocks
1 parent 2d0242a commit 14cf22fCopy full SHA for 14cf22f
doc/api/fs.md
@@ -3414,8 +3414,7 @@ to compare `curr.mtime` and `prev.mtime`.
3414
3415
When an `fs.watchFile` operation results in an `ENOENT` error, it
3416
will invoke the listener once, with all the fields zeroed (or, for dates, the
3417
-Unix Epoch). In Windows, `blksize` and `blocks` fields will be `undefined`,
3418
-instead of zero. If the file is created later on, the listener will be called
+Unix Epoch). If the file is created later on, the listener will be called
3419
again, with the latest stat objects. This is a change in functionality since
3420
v0.10.
3421
lib/internal/fs/utils.js
@@ -315,9 +315,9 @@ Stats.prototype.isSocket = function() {
315
function getStatsFromBinding(stats, offset = 0) {
316
return new Stats(stats[0 + offset], stats[1 + offset], stats[2 + offset],
317
stats[3 + offset], stats[4 + offset], stats[5 + offset],
318
- isWindows ? undefined : stats[6 + offset], // blksize
+ stats[6 + offset], // blksize
319
stats[7 + offset], stats[8 + offset],
320
- isWindows ? undefined : stats[9 + offset], // blocks
+ stats[9 + offset], // blocks
321
stats[10 + offset], stats[11 + offset],
322
stats[12 + offset], stats[13 + offset]);
323
}
src/node_file.h
@@ -199,18 +199,10 @@ constexpr void FillStatsArray(AliasedBuffer<NativeT, V8T>* fields,
199
fields->SetValue(offset + 3, s->st_uid);
200
fields->SetValue(offset + 4, s->st_gid);
201
fields->SetValue(offset + 5, s->st_rdev);
202
-#if defined(__POSIX__)
203
fields->SetValue(offset + 6, s->st_blksize);
204
-#else
205
- fields->SetValue(offset + 6, 0);
206
-#endif
207
fields->SetValue(offset + 7, s->st_ino);
208
fields->SetValue(offset + 8, s->st_size);
209
210
fields->SetValue(offset + 9, s->st_blocks);
211
212
- fields->SetValue(offset + 9, 0);
213
214
// Dates.
215
fields->SetValue(offset + 10, ToNative<NativeT>(s->st_atim));
216
fields->SetValue(offset + 11, ToNative<NativeT>(s->st_mtim));
test/parallel/test-fs-stat-bigint.js
@@ -59,9 +59,6 @@ function verifyStats(bigintStats, numStats) {
59
bigintStats.isSymbolicLink(),
60
numStats.isSymbolicLink()
61
);
62
- } else if (common.isWindows && (key === 'blksize' || key === 'blocks')) {
63
- assert.strictEqual(bigintStats[key], undefined);
64
- assert.strictEqual(numStats[key], undefined);
65
} else if (Number.isSafeInteger(val)) {
66
assert.strictEqual(
67
bigintStats[key], BigInt(val),
test/parallel/test-fs-stat.js
@@ -94,16 +94,13 @@ fs.stat(__filename, common.mustCall(function(err, s) {
94
assert.strictEqual(s.isSymbolicLink(), false);
95
const keys = [
96
'dev', 'mode', 'nlink', 'uid',
97
- 'gid', 'rdev', 'ino', 'size',
+ 'gid', 'rdev', 'blksize', 'ino', 'size', 'blocks',
98
'atime', 'mtime', 'ctime', 'birthtime',
99
'atimeMs', 'mtimeMs', 'ctimeMs', 'birthtimeMs'
100
];
101
- if (!common.isWindows) {
102
- keys.push('blocks', 'blksize');
103
- }
104
const numberFields = [
105
- 'dev', 'mode', 'nlink', 'uid', 'gid', 'rdev', 'ino', 'size',
106
- 'atimeMs', 'mtimeMs', 'ctimeMs', 'birthtimeMs'
+ 'dev', 'mode', 'nlink', 'uid', 'gid', 'rdev', 'blksize', 'ino', 'size',
+ 'blocks', 'atimeMs', 'mtimeMs', 'ctimeMs', 'birthtimeMs'
107
108
const dateFields = ['atime', 'mtime', 'ctime', 'birthtime'];
109
keys.forEach(function(k) {
test/parallel/test-fs-watchfile-bigint.js
@@ -15,10 +15,10 @@ const expectedStatObject = new fs.Stats(
15
0n, // uid
16
0n, // gid
17
0n, // rdev
18
- common.isWindows ? undefined : 0n, // blksize
+ 0n, // blksize
19
0n, // ino
20
0n, // size
21
- common.isWindows ? undefined : 0n, // blocks
+ 0n, // blocks
22
0n, // atim_msec
23
0n, // mtim_msec
24
0n, // ctim_msec
test/parallel/test-fs-watchfile.js
@@ -38,10 +38,10 @@ const expectedStatObject = new fs.Stats(
38
0, // uid
39
0, // gid
40
0, // rdev
41
- common.isWindows ? undefined : 0, // blksize
+ 0, // blksize
42
0, // ino
43
0, // size
44
- common.isWindows ? undefined : 0, // blocks
+ 0, // blocks
45
Date.UTC(1970, 0, 1, 0, 0, 0), // atime
46
Date.UTC(1970, 0, 1, 0, 0, 0), // mtime
47
Date.UTC(1970, 0, 1, 0, 0, 0), // ctime
0 commit comments