Module basic module

Module encoding

Encoding and decoding module, used to process the conversion between different data encoding formats and binary

Reference method:

1
var encoding = require('encoding');

Object

base32

base32 Encoding and decoding module

1
base32 encoding.base32;

base64

base64 Encoding and decoding module

1
base64 encoding.base64;

hex

hex Encoding and decoding module

1
hex encoding.hex;

iconv

iconv Encoding and decoding module

1
iconv encoding.iconv;

json

json Encoding and decoding module

1
json encoding.json;

msgpack

msgpack Encoding and decoding module

1
msgpack encoding.msgpack;

Static function

jsstr

Encode a string into a javascript escaped string to include text in the javascript code

1 2
static String encoding.jsstr(String str, Boolean json = false);

Call parameters:

  • str: String, the string to be encoded
  • json: Boolean, whether to generatejsonCompatible string

Return result:

  • String, Return the encoded string

encodeURI

url String safe encoding

1
static String encoding.encodeURI(String url);

Call parameters:

  • url: String, to be encoded url

Return result:

  • String, Return the encoded string

encodeURIComponent

url Part string security encoding

1
static String encoding.encodeURIComponent(String url);

Call parameters:

  • url: String, to be encoded url

Return result:

  • String, Return the encoded string

decodeURI

url Secure string decoding

1
static String encoding.decodeURI(String url);

Call parameters:

  • url: String, to be decoded url

Return result:

  • String, Return the decoded string