Added stats object.
This commit is contained in:
parent
dabf8c8c7a
commit
aeccbd4d3f
|
@ -5887,6 +5887,21 @@ define('src/file-system',['require','lodash','when','src/path','src/path','src/p
|
|||
this.data = hash(guid()); // id for data object
|
||||
};
|
||||
|
||||
/*
|
||||
* Stats
|
||||
*/
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
/*
|
||||
* find_node
|
||||
*/
|
||||
|
@ -6755,16 +6770,7 @@ define('src/file-system',['require','lodash','when','src/path','src/path','src/p
|
|||
// if(transaction.error) transaction.abort();
|
||||
deferred.reject(error);
|
||||
} else {
|
||||
var stats = {
|
||||
node: result.id,
|
||||
dev: that.name,
|
||||
size: result.size,
|
||||
nlinks: result.nlinks,
|
||||
atime: result.atime,
|
||||
mtime: result.mtime,
|
||||
ctime: result.ctime,
|
||||
type: result.mode,
|
||||
};
|
||||
var stats = new Stats(result, that.name);
|
||||
deferred.resolve(stats);
|
||||
}
|
||||
};
|
||||
|
@ -6797,16 +6803,7 @@ define('src/file-system',['require','lodash','when','src/path','src/path','src/p
|
|||
// if(transaction.error) transaction.abort();
|
||||
deferred.reject(error);
|
||||
} else {
|
||||
var stats = {
|
||||
node: result.id,
|
||||
dev: that.name,
|
||||
size: result.size,
|
||||
nlinks: result.nlinks,
|
||||
atime: result.atime,
|
||||
mtime: result.mtime,
|
||||
ctime: result.ctime,
|
||||
type: result.mode,
|
||||
};
|
||||
var stats = new Stats(result, that.name);
|
||||
deferred.resolve(stats);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -35,6 +35,10 @@ fs.open('/tmp', 'w+', function(error, fd) {
|
|||
fs.close(fd, function(error) {
|
||||
if(error) throw error;
|
||||
console.log('closed');
|
||||
fs.stat('/tmp', function(error, stats) {
|
||||
if(error) throw error;
|
||||
console.log('stats:', stats);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -87,6 +87,21 @@ define(function(require) {
|
|||
this.data = hash(guid()); // id for data object
|
||||
};
|
||||
|
||||
/*
|
||||
* Stats
|
||||
*/
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
/*
|
||||
* find_node
|
||||
*/
|
||||
|
@ -955,16 +970,7 @@ define(function(require) {
|
|||
// if(transaction.error) transaction.abort();
|
||||
deferred.reject(error);
|
||||
} else {
|
||||
var stats = {
|
||||
node: result.id,
|
||||
dev: that.name,
|
||||
size: result.size,
|
||||
nlinks: result.nlinks,
|
||||
atime: result.atime,
|
||||
mtime: result.mtime,
|
||||
ctime: result.ctime,
|
||||
type: result.mode,
|
||||
};
|
||||
var stats = new Stats(result, that.name);
|
||||
deferred.resolve(stats);
|
||||
}
|
||||
};
|
||||
|
@ -997,16 +1003,7 @@ define(function(require) {
|
|||
// if(transaction.error) transaction.abort();
|
||||
deferred.reject(error);
|
||||
} else {
|
||||
var stats = {
|
||||
node: result.id,
|
||||
dev: that.name,
|
||||
size: result.size,
|
||||
nlinks: result.nlinks,
|
||||
atime: result.atime,
|
||||
mtime: result.mtime,
|
||||
ctime: result.ctime,
|
||||
type: result.mode,
|
||||
};
|
||||
var stats = new Stats(result, that.name);
|
||||
deferred.resolve(stats);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue