Base64 encoding and decoding in client-side Javascript

前端 未结 14 2058
挽巷
挽巷 2020-11-22 04:27

Are there any methods in JavaScript that could be used to encode and decode a string using base64 encoding?

14条回答
  •  伪装坚强ぢ
    2020-11-22 05:01

    In Node.js we can do it in simple way

    var base64 = 'SGVsbG8gV29ybGQ='
    var base64_decode = new Buffer(base64, 'base64').toString('ascii');
    
    console.log(base64_decode); // "Hello World"
    

提交回复
热议问题