浏览代码

修改文件接口

dygapp 4 年之前
父节点
当前提交
17aedf6dd0
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      app/extend/application.js

+ 4 - 2
app/extend/application.js

@@ -1,10 +1,12 @@
 'use strict';
-const fs = require('fs/promises');
+const fs = require('fs');
+const util = require('util');
+const readFile = util.promisify(fs.readFile);
 
 module.exports = {
   async readConfig(path) {
     try {
-      const data = await fs.readFile(path);
+      const data = await readFile(path);
       return JSON.parse(data);
     } catch (error) {
       const body = { errcode: -1000, errmsg: '读取配置文件失败', error };