![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ES6
SaiwenOutMan
404notFound
展开
-
从如何优雅的将类数组对象转化为数组谈起
从如何优雅的将类数组对象转化为数组谈起今日研读阮老师的ES6标准入门,读到函数的扩展方法时看到这么一段代码:let arrayList = { "0":"a", &原创 2020-04-08 21:30:03 · 1195 阅读 · 0 评论 -
node.js将异步的遍历文件目录改成同步
我们都知道,如果想读取某一目录下的文件时,需使用fs.readdir来进行,看如下代码:function getFileList(filePath){ fs.readdir(filePath, (err, files)=> { var listArr = []; files.forEach(filename => { listArr.push(filename)...原创 2018-11-15 14:31:30 · 2274 阅读 · 2 评论 -
async和await改写node.js的读取文件函数
const fs = require('fs');const path = require('path');function getFile() { return new Promise((resolve, reject) => { const filePath = path.resolve(path.join(__dirname, '../public/ima...原创 2019-03-07 09:39:49 · 944 阅读 · 1 评论