![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
nodejs
微机原理通识
偏爱前端
展开
-
HTTP服务器http-server
http-server is a simple, zero-configuration command-line http server. It is powerful enough for production usage, but it’s simple and hackable enough to be used for testing, local development, and lea...原创 2018-04-18 14:02:39 · 1832 阅读 · 0 评论 -
服务器代理工具NProxy
1.安装使用npm安装:npm install -g nproxy-V 查看版本号-h 获取帮助信息-l 定义替换规则文件-p 定义代理监听端口,默认为8989-t 定义请求超时时间 nproxy -t 5module.exports = [ //1.单个文件替换(本地) { ...原创 2018-04-18 14:04:47 · 951 阅读 · 0 评论 -
Nodejs文件的压缩与解压===使用管道实现
本文转载自:https://blog.csdn.net/u013127751/article/details/78537957//所有的 Stream 对象都是 EventEmitter 的实例,所以可以使用EventEmitter类的方法/* * 从流中读取数据 */var fs = require("fs");var data = '';//创建可读流var reade...转载 2018-08-17 15:03:40 · 1597 阅读 · 0 评论 -
npm的简单安装用法
npm node package managerhttp-server anywherenpm库 帮我们将我们的包上传到网上第三方模块我们下载的模块 不需要加./ 引得是 module.paths安装 卸载 发布安装前npm init -y初始化前先关心当前文件夹 不能有中文 特殊字符串 不能用要安装的模块来命名初始化一个package.json 不能写注释 不能加标点如果...原创 2018-11-29 00:15:08 · 583 阅读 · 0 评论 -
es6 -- promisify
promise的简单使用(() => new Promise((resolve, reject) => setTimeout(() => resolve('jianyong'), 2000)))().then(data => console.log(data))上面一行恶心的代码等价于:function getName() { let p p = n...转载 2018-12-02 14:00:52 · 409 阅读 · 0 评论 -
es6 -- Buffer
通过长度创建buffer:let buffer = Buffer.alloc(100);console.log(buffer)得到:<buffer 00 00 00 00 00 00 00 00···> 100个比较消耗性能:先将100字节清空再分配let buffer = Buffer.allocUnsafe(100);不清空,可能还有上一次的内容数组转bu...原创 2018-12-02 14:25:08 · 858 阅读 · 0 评论 -
node核心模块--Util
class child{}class parent{ constructor(){ } sleep(){console.log("i'm sleeping")}}//实现继承let child = new child();let parent = new parent();//原生写法: child.prototype.__proto__ = parent.prototype...原创 2018-11-29 19:19:15 · 141 阅读 · 0 评论 -
node模块的引用过程
劲爆自定义模块:class cal{ constructor(){ this.a = 'wo hen shuai' } static tittle(){ return '标题'; } calc((...args)=>{ return args.reduce((prev,next)=>{ return prev + next; }); });}...原创 2018-11-28 00:28:11 · 240 阅读 · 0 评论