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;

base64vlq

base64vlq encoding and decoding module

1
base64vlq encoding.base64vlq;

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;

bson

bson encoding and decoding module

1
bson encoding.bson;

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 generate a json compatible string

Return result:

  • String , returns the encoded string

encodeURI

url string security encoding

1
static String encoding.encodeURI(String url);

Call parameters:

  • url : String, url to be encoded

Return result:

  • String , returns the encoded string

encodeURIComponent

url component string security encoding

1
static String encoding.encodeURIComponent(String url);

Call parameters:

  • url : String, url to be encoded

Return result:

  • String , returns the encoded string

decodeURI

url safe string decoding

1
static String encoding.decodeURI(String url);

Call parameters:

  • url : String, url to be decoded

Return result:

  • String , returns the decoded string