|
@@ -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 };
|