摘要: 阅读全文
posted @ 2019-11-21 17:52 tomatoa 阅读(190) 评论(0) 推荐(0) 编辑
摘要: pipe管道 阅读全文
posted @ 2019-11-21 17:13 tomatoa 阅读(462) 评论(0) 推荐(0) 编辑
摘要: 官方api文档:http://nodejs.cn/api/child_process.html 众所周知node.js是基于单线程模型架构,这样的设计可以带来高效的CPU利用率,但是无法却利用多个核心的CPU,为了解决这个问题,node.js提供了child_process模块,通过多进程来实现对多 阅读全文
posted @ 2019-11-18 18:50 tomatoa 阅读(447) 评论(0) 推荐(0) 编辑
摘要: 提到node,我们就可以立刻想到单线程、异步IO、事件驱动等字眼。首先要明确的是node真的是单线程的吗,如果是单线程的,那么异步IO,以及定时事件(setTimeout、setInterval等)又是在哪里被执行的。 其实,按照严格来说,node并不是单线程的。node中存在着多种线程,包括: j 阅读全文
posted @ 2019-11-18 17:42 tomatoa 阅读(643) 评论(0) 推荐(1) 编辑
摘要: 1 program.command('find <name>').action(name => { 2 if (name) { 3 inquirer 4 .prompt([ 5 { 6 type: 'input', 7 name: 'isAll', 8 message: '输入的文件名是否是文件全称 阅读全文
posted @ 2019-11-06 14:59 tomatoa 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 1.遍历文件-node 1 // 递归遍历目录下的文件 2 function readDirSync (path) { 3 var pa = fs.readdirSync(path); 4 pa.forEach(function (ele, index) { 5 var info = fs.stat 阅读全文
posted @ 2019-11-04 16:24 tomatoa 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 一般循环用for,for...in,for...of和forEach 需要映射为新数组的用map, 需要筛选出想要的用filter, 数值需要进行累加的用reduce, 如果要找一些值用some和every, 如果想知道值的具体位置的可以用indexOf和lastIndexOf 阅读全文
posted @ 2019-10-31 18:59 tomatoa 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 20190916 阅读全文
posted @ 2019-09-16 16:26 tomatoa 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 20190911 阅读全文
posted @ 2019-09-11 14:06 tomatoa 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 关于堆栈一些事情 阅读全文
posted @ 2019-08-26 16:55 tomatoa 阅读(106) 评论(0) 推荐(0) 编辑