promisify问题
promisify = require('util).promisify
const read = promisify( fs.readFile);
read('input.txt').then(data=>{
}).catch(err=>{
})
async function test(){
try{
const res = await read('input.txt')
}catch(ex){
console.log(ex)
}
}
promisify问题
promisify = require('util).promisify
const read = promisify( fs.readFile);
read('input.txt').then(data=>{
}).catch(err=>{
})
async function test(){
try{
const res = await read('input.txt')
}catch(ex){
console.log(ex)
}
}