mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
31 lines
757 B
JavaScript
31 lines
757 B
JavaScript
(function () {
|
|
'use strict';
|
|
|
|
var fs = require('fs'),
|
|
Util = require('../util');
|
|
|
|
exports.get = function(filename, option, callback) {
|
|
var isRaw = option === 'raw';
|
|
|
|
if (!callback)
|
|
callback = option;
|
|
|
|
Util.checkArgs(arguments, ['filename', 'callback']);
|
|
|
|
fs.stat(filename, function(error, stat) {
|
|
var time, timeRet;
|
|
|
|
if (!error) {
|
|
time = stat.mtime;
|
|
|
|
if (isRaw)
|
|
timeRet = time.getTime();
|
|
else
|
|
timeRet = time;
|
|
}
|
|
|
|
callback(error, timeRet);
|
|
});
|
|
};
|
|
|
|
})();
|