From c7f424e44b7e61b89f91cd344599c3d1cdfb88fe Mon Sep 17 00:00:00 2001 From: Trevor Norris Date: Mon, 14 Apr 2014 16:35:33 -0700 Subject: [PATCH] fs: return blksize on stats object 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. --- lib/fs.js | 2 ++ src/node_file.cc | 1 + test/simple/test-fs-stat.js | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/lib/fs.js b/lib/fs.js index 129d4ee192b..b61a1f5f4e0 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -125,6 +125,7 @@ fs.Stats = function( uid, gid, rdev, + blksize, ino, size, blocks, @@ -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; diff --git a/src/node_file.cc b/src/node_file.cc index 8b18b82c963..f50ed7ad408 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -400,6 +400,7 @@ Local BuildStatsObject(Environment* env, const uv_stat_t* s) { uid, gid, rdev, + blksize, ino, size, blocks, diff --git a/test/simple/test-fs-stat.js b/test/simple/test-fs-stat.js index 90b0ba52d4a..8c5a9c64c15 100644 --- a/test/simple/test-fs-stat.js +++ b/test/simple/test-fs-stat.js @@ -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;