📌  相关文章
📜  nodejs buffer.from base64 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:18.040000             🧑  作者: Mango

代码示例3
//--------------- HOW TO ENCODE BASE64 ON NODEJS ----------------------
//create a buffer of the text "Hello World"
var buffer = Buffer.from('Hello World');
//buffer result is: 

var string64 = buffer.toString('base64');
// .toString('base64') allow to encode it to base64
// result is: SGVsbG8gV29ybGQ=

// Can be use combined together like these
console.log(Buffer.from('Hello World').toString('base64'));
// result is: SGVsbG8gV29ybGQ=