Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
fs: return blksize on stats object
Browse files Browse the repository at this point in the history
Oversight to not pass blksize to fs.Stats on initialization.

Also added a test to make sure the object property has been set. Since
now on Windows both blksize and blocks will simply be set to undefined.
  • Loading branch information
trevnorris committed Apr 14, 2014
1 parent 940974e commit c7f424e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ fs.Stats = function(
uid,
gid,
rdev,
blksize,
ino,
size,
blocks,
Expand All @@ -138,6 +139,7 @@ fs.Stats = function(
this.uid = uid;
this.gid = gid;
this.rdev = rdev;
this.blksize = blksize;
this.ino = ino;
this.size = size;
this.blocks = blocks;
Expand Down
1 change: 1 addition & 0 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ Local<Value> BuildStatsObject(Environment* env, const uv_stat_t* s) {
uid,
gid,
rdev,
blksize,
ino,
size,
blocks,
Expand Down
5 changes: 5 additions & 0 deletions test/simple/test-fs-stat.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ fs.stat('.', function(err, stats) {
assert(this === global);
});

fs.stat('.', function(err, stats) {
assert.ok(stats.hasOwnProperty('blksize'));
assert.ok(stats.hasOwnProperty('blocks'));
});

fs.lstat('.', function(err, stats) {
if (err) {
got_error = true;
Expand Down

2 comments on commit c7f424e

@piscisaureus
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Libuv does report blocks and blksize on windows. Why is it not forwarded to node?

@trevnorris
Copy link
Author

@trevnorris trevnorris commented on c7f424e Apr 15, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.