Module Basic module

Module encoding

Encoding and decoding module, used to handle 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 as a javascript escape string to include text in 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 json compatible string

Return result:

  • String , return the encoded string

encodeURI

url string security encoding

1
static String encoding.encodeURI(String url);

Call parameters:

  • url : String, the url to encode

Return result:

  • String , return the encoded string

encodeURIComponent

Safe encoding of url part string

1
static String encoding.encodeURIComponent(String url);

Call parameters:

  • url : String, the url to encode

Return result:

  • String , return the encoded string

decodeURI

url safe string decoding

1
static String encoding.decodeURI(String url);

Call parameters:

  • url : String, the url to decode

Return result:

  • String , return the decoded string