ES6
SaiwenOutMan
404notFound
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
从如何优雅的将类数组对象转化为数组谈起
从如何优雅的将类数组对象转化为数组谈起 今日研读阮老师的ES6标准入门,读到函数的扩展方法时看到这么一段代码: let arrayList = { "0":"a", &原创 2020-04-08 21:30:03 · 1279 阅读 · 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 · 2952 阅读 · 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 · 1037 阅读 · 1 评论
分享