refactor(cloudcmd) readConfig: add encoding

This commit is contained in:
coderaiser 2014-02-10 03:56:56 -05:00
parent 1fc1199f31
commit bd1ecc950e

View file

@ -181,16 +181,15 @@
});
}
function readConfig(pCallBack) {
fs.readFile(CONFIG_PATH, function(pError, pData) {
var msg, status, str, readed;
function readConfig(callback) {
fs.readFile(CONFIG_PATH, 'utf8', function(error, data) {
var msg, status, readed;
if (pError)
if (error)
status = 'error';
else {
status = 'ok';
str = pData.toString(),
readed = Util.parseJSON(str);
readed = Util.parseJSON(data);
main.config = Config = readed;
}
@ -198,7 +197,7 @@
msg = CloudFunc.formatMsg('read', 'config', status);
Util.log(msg);
Util.exec(pCallBack);
Util.exec(callback);
});
}