filer/src/stats.js

38 lines
898 B
JavaScript
Raw Normal View History

2014-03-18 16:29:20 +00:00
define(['src/constants'], function(Constants) {
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;
}
Stats.prototype.isFile = function() {
return this.type === Constants.MODE_FILE;
};
Stats.prototype.isDirectory = function() {
return this.type === Constants.MODE_DIRECTORY;
};
Stats.prototype.isSymbolicLink = function() {
return this.type === Constants.MODE_SYMBOLIC_LINK;
};
// These will always be false in Filer.
Stats.prototype.isSocket =
Stats.prototype.isFIFO =
Stats.prototype.isCharacterDevice =
Stats.prototype.isBlockDevice =
function() {
return false;
};
return Stats;
});