filer/src/stats.js

36 lines
842 B
JavaScript
Raw Normal View History

var Constants = require('./constants.js');
2014-03-18 16:29:20 +00:00
function Stats(fileNode, devName) {
this.node = fileNode.id;
this.dev = devName;
this.size = fileNode.size;
this.nlinks = fileNode.nlinks;
this.atime = fileNode.atime;
this.mtime = fileNode.mtime;
this.ctime = fileNode.ctime;
this.type = fileNode.mode;
}
2014-03-18 16:29:20 +00:00
Stats.prototype.isFile = function() {
return this.type === Constants.MODE_FILE;
};
2014-03-18 16:29:20 +00:00
Stats.prototype.isDirectory = function() {
return this.type === Constants.MODE_DIRECTORY;
};
2014-03-18 16:29:20 +00:00
Stats.prototype.isSymbolicLink = function() {
return this.type === Constants.MODE_SYMBOLIC_LINK;
};
2014-03-18 16:29:20 +00:00
// These will always be false in Filer.
Stats.prototype.isSocket =
Stats.prototype.isFIFO =
Stats.prototype.isCharacterDevice =
Stats.prototype.isBlockDevice =
function() {
return false;
};
2014-03-18 16:29:20 +00:00
module.exports = Stats;