Skip to content

Commit

Permalink
Node 0.11.13 (deal with binding.FSInitialize)
Browse files Browse the repository at this point in the history
In order to support both v0.11.13 and older v0.11 releases, this includes a slightly modified version of the fs module from v0.11.13.  In the modified version, binding.FSInitialize is only called if it exists (which it doesn't prior to v0.11.13).
  • Loading branch information
tschaub committed May 2, 2014
1 parent f638e1d commit 26c10b2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var versions = {
'0.8': 'fs-0.8.26.js',
'0.9': 'fs-0.9.12.js',
'0.10': 'fs-0.10.28.js',
'0.11': 'fs-0.11.12.js'
'0.11': 'fs-0.11.13.js'
};

var fsName = versions[minor];
Expand Down
39 changes: 38 additions & 1 deletion node/fs-0.11.12.js → node/fs-0.11.13.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,44 @@ function nullCheck(path, callback) {
return true;
}

fs.Stats = binding.Stats;
// Static method to set the stats properties on a Stats object.
fs.Stats = function(
dev,
mode,
nlink,
uid,
gid,
rdev,
blksize,
ino,
size,
blocks,
atim_msec,
mtim_msec,
ctim_msec,
birthtim_msec) {
this.dev = dev;
this.mode = mode;
this.nlink = nlink;
this.uid = uid;
this.gid = gid;
this.rdev = rdev;
this.blksize = blksize;
this.ino = ino;
this.size = size;
this.blocks = blocks;
this.atime = new Date(atim_msec);
this.mtime = new Date(mtim_msec);
this.ctime = new Date(ctim_msec);
this.birthtime = new Date(birthtim_msec);
};

// Create a C++ binding to the function which creates a Stats object.
if (binding.FSInitialize) {
binding.FSInitialize(fs.Stats);
} else if (binding.Stats) {
fs.Stats = binding.Stats;
}

fs.Stats.prototype._checkModeProperty = function(property) {
return ((this.mode & constants.S_IFMT) === property);
Expand Down

0 comments on commit 26c10b2

Please sign in to comment.