摘要:
/* 什么是 Buffer? Buffer 就是 Node.js 处理二进制数据的容器 在 ES6 之前,JS 并没有处理二进制的机制, 在 ES6 之后,JS 使用了 TypedArray 里的 Uint8Array 作为 Buffer 的底层 Buffer 类似于整数的数组,但是长度受限(8bi 阅读全文
posted @ 2020-12-28 17:28
小白咚
阅读(759)
评论(0)
推荐(0)
摘要:
// 事件(Event)机制 const EventEmitter = require('events'); const emitter = new EventEmitter(); // 侦听一个事件 emitter.on("a", (event) => { console.log(event + 阅读全文
posted @ 2020-12-28 16:28
小白咚
阅读(1292)
评论(0)
推荐(0)
摘要:
创建 UDP 服务器 const dgram = require('dgram'); const server = dgram.createSocket('udp4'); // 创建 message 事件的接收器 server.on('message', (msg, rinfo) => { cons 阅读全文
posted @ 2020-12-28 15:45
小白咚
阅读(196)
评论(0)
推荐(0)
摘要:
for(var k of Object.keys(global)){console.log(k)} global clearInterval clearTimeout setInterval setTimeout queueMicrotask clearImmediate setImmediate 阅读全文
posted @ 2020-12-28 13:59
小白咚
阅读(122)
评论(0)
推荐(0)
摘要:
{ overflow: hidden; text-overflow: ellipsis; // 显示省略符号来代表被修剪的文本 white-space: nowrap; // 文本不会换行,文本会在在同一行上继续 display: block; // 此元素将显示为块级元素,此元素前后会带有换行符 阅读全文
posted @ 2020-12-28 10:09
小白咚
阅读(131)
评论(1)
推荐(0)
摘要:
如果Content-Type设置为“application/x-www-form-urlencoded;charset=UTF-8”无论是POST请求还是GET请求都是可以通过这种方式成功获取参数,但是如果前端POST请求中的body是Json对象的话,会报上述错误。 请求中传JSON时设置的Con 阅读全文
posted @ 2020-12-28 08:37
小白咚
阅读(9159)
评论(0)
推荐(1)