Object built-in object

ObjectTextDecoder

TextDecoder decoding object

Create method

1
var textDecoder = new util.TextDecoder('utf8');

inheritance relationship

Constructor

TextDecoder

TextDecoder object constructor, constructed using parameters

1 2
new TextDecoder(String codec = "utf8", Object opts = {});

Call parameters:

  • codec: String, specifies the decoding character set
  • opts: Object, specify decoding options

member properties

encoding

String, query the current encoding character set

1
readonly String TextDecoder.encoding;

member function

decode

Convert binary data to text

1 2
String TextDecoder.decode(Buffer data, Object opts = {});

Call parameters:

  • data:Buffer, the binary to convert
  • opts: Object, specify decoding options

Return results:

  • String, returns the decoded text

Convert binary data to text

1
String TextDecoder.decode();

Return results:

  • String, returns the decoded text

toString

Returns the string representation of the object. Generally, "[Native Object]" is returned. The object can be re-implemented according to its own characteristics.

1
String TextDecoder.toString();

Return results:

  • String, returns the string representation of the object

toJSON

Returns a JSON format representation of the object, generally returning a collection of readable properties defined by the object.

1
Value TextDecoder.toJSON(String key = "");

Call parameters:

  • key: String, not used

Return results:

  • Value, returns a value containing JSON serializable