module base64
base64 encoding and decoding module
Citation:
1
2var encoding = require('encoding');
var base64 = encoding.base64;
or
1var base64 = require('base64');
static function
encode
encode data in base64
1
2static String base64.encode(Buffer data,
Boolean url = false);
Call parameters:
- data:Buffer, the data to be encoded
- url: Boolean, specifies whether to useurlsafe character encoding
Return result:
- String, returns the encoded string
decode
Decode a string to binary data in base64
1static Buffer base64.decode(String data);
Call parameters:
- data: String, the string to decode
Return result:
- Buffer, returns the decoded binary data