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'));
buffer ==== >>> array
var raw = "xxxxxxxxxxxx"
var base64 = new Buffer(raw,'base64')
console.error(Array.from(base64))

 

你可能感兴趣的:(js)