uint8array 转buffer

 let u8a=new Uint8Array(10);
    u8a.set([0x3d],0)
    console.log(Buffer.from(u8a,'hex'));
const buffer = require('buffer');

const newBuf = buffer.transcode(Buffer.from('€'), 'utf8', 'ascii');
console.log(newBuf.toString('ascii'));

猜你喜欢

转载自blog.csdn.net/changliangwl/article/details/81939148