mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(time) add options
This commit is contained in:
parent
1ef8af92cb
commit
e2dbbf9019
1 changed files with 17 additions and 5 deletions
|
|
@ -13,14 +13,26 @@
|
|||
fs = require('fs'),
|
||||
Util = main.util;
|
||||
|
||||
object.get = function(filename, callback) {
|
||||
object.get = function(filename, options, callback) {
|
||||
var noOptions = Util.isFunction(options);
|
||||
|
||||
if (!callback && noOptions)
|
||||
callback = options;
|
||||
|
||||
fs.stat(filename, function(error, stat) {
|
||||
var time;
|
||||
var time, timeRet;
|
||||
|
||||
if (!error)
|
||||
time = stat.mtime.getTime();
|
||||
if (!error) {
|
||||
time = stat.mtime;
|
||||
|
||||
if (options && options.str)
|
||||
timeRet = time;
|
||||
else
|
||||
timeRet = time.getTime();
|
||||
}
|
||||
|
||||
|
||||
Util.exec(callback, error, time);
|
||||
Util.exec(callback, error, timeRet);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue