Module Basic module

Module hex

hex encoding and decoding module

Reference method:

1 2
var encoding = require('encoding'); var hex = encoding.hex;

or

1
var hex = require('hex');

Static function

encode

Encode data in hex

1
static String hex.encode(Buffer data);

Call parameters:

  • data : Buffer , the data to be encoded

Return result:

  • String , return the encoded string

decode

Decode a string as binary data in hex mode

1
static Buffer hex.decode(String data);

Call parameters:

  • data : String, the string to decode

Return result:

  • Buffer , returns the decoded binary data