const fs = require('fs');
let promise = new Promise((resolve, reject) => {
fs.readFile('./1.txt', 'utf8', (err, result) => {
if (err != null) {
reject(err);
} else {
resolve(result)
}
});
});
promise.then(result => {
console.log(result);
})
.catch((err) => {
console.log(err);
})
标签:fs,log,err,node35,promise,result,reject From: https://www.cnblogs.com/yao-655442/p/16651452.html