async 函数

const asyncReadFile = async function () {
  const f1 = await readFile('/etc/fstab');
  const f2 = await readFile('/etc/shells');
  console.log(f1.toString());
  console.log(f2.toString());
};

  等待f1加载完才执行下一行

posted @ 2017-12-08 15:31  fm060  阅读(106)  评论(0)    收藏  举报