buffer——class 以你之姓@ 2022-05-17 13:09 150阅读 0赞 //Buffer.byteLength是计算字节个数 console.log(Buffer.byteLength('test')); console.log(Buffer.byteLength('测试')); //判断是不是Buffer对象 console.log(Buffer.isBuffer(\{\})); console.log(Buffer.isBuffer(Buffer.from(\[1,2,3\]))); //Buffer.concat()是把字符连接起来 const buf1 = Buffer.from('this') const buf2 = Buffer.from('is') const buf3 = Buffer.from('test') const buf4 = Buffer.from('!') const buf=Buffer.concat(\[buf1,buf2,buf3,buf4\]); console.log(buf.toString()); ![70][] [70]: /images/20220517/9d48a5c5e3d34e18bad59d054981dc7c.png
还没有评论,来说两句吧...