//异步流程: 回调1.回调地狱 2.try catch 3.并发 4.promise 5.genorator 6.async+await 7genorator+co
代码如下:
//相当于更迭器*变为async await 这是异步的实际上是genorator 使用更迭器来说实现的,返回值也是promise
let fs = require('mz/fs')

async function readName() {
    try {
        let content = await fs.readFile('./aa.txt', 'utf8');
        let name = await fs.readFile(content, 'utf8');
        return name

    } catch (err) {
        console.log(err)
    }

}
// async 函数返回的值是一个promise实例,捕获异常通常在try catch 不是在then函数下捕获
readName().then(data => {
    console.log(data)
});
//同时拿到异步请求
async function readName() {
    await Promise.all([fs.readFile(), fs.readFile()])
}