bug_x

导航

 

 nodeJs读取文件(readfile)

 

j

json 处理:

var fileData = fs.readFileSync(file);
if (fileData) {
  var j = {};
callWitoutException(function () {
j = JSON.parse(
fileData);
  });
return j ? j : {};
}
return {};

 

posted on 2017-07-17 09:50  bug_x  阅读(212)  评论(0编辑  收藏  举报