1 2 3 4
摘要: 1.argv const {argv,argv0,execPath v,execPath} = process;argv.forEach(item=>{ console.log(item); }} argv打印出来是一个数组,第一个值是 启动它的命令node安装的路径。 第二个值是当前执行的文件路径 阅读全文
posted @ 2019-11-26 18:35 红鲤鱼与LV 阅读(560) 评论(0) 推荐(0) 编辑
摘要: 1.使终端输出红色字体: const chalk = require('chalk'); console.log(chalk.red('this is red!') 这时运行终端,打印的this is red!就是红色的。 使用这个插件还可以使终端打印的字加下划线等等。 阅读全文
posted @ 2019-11-26 17:57 红鲤鱼与LV 阅读(512) 评论(0) 推荐(0) 编辑
摘要: 如果data为buffer格式,则: data.toString()。 或者data+"" , 也可以转成字符串 阅读全文
posted @ 2019-11-26 17:53 红鲤鱼与LV 阅读(8704) 评论(0) 推荐(3) 编辑
摘要: 1.CommonJS 每个文件是一个模块,有自己的作用域 引入: 阅读全文
posted @ 2019-11-26 17:48 红鲤鱼与LV 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 1.get: const body = ctx.query; // get请求 2.post: const body = ctx.request.body; // post请求 阅读全文
posted @ 2019-11-26 16:23 红鲤鱼与LV 阅读(571) 评论(0) 推荐(0) 编辑
摘要: 1.复制: 2.粘贴到终端,回车。就运行啦 3.额外附赠小知识: 到终端粘贴,后面加上 -o,就可以保存啦。有些不能下载的音频视频可以这样保存。 4.下面是别人写的,我看着挺好的: https://blog.csdn.net/fdipzone/article/details/78828617 阅读全文
posted @ 2019-11-26 14:42 红鲤鱼与LV 阅读(193) 评论(0) 推荐(0) 编辑
摘要: npm地址:https://www.npmjs.com/package/numeral 1.转化成百分比: numeral(num).format('0.00%') 阅读全文
posted @ 2019-11-26 14:10 红鲤鱼与LV 阅读(947) 评论(0) 推荐(0) 编辑