dwebx-encoding
DWebX's way of encoding and decoding dwebx links.
Example
var encoding = var link = '6161616161616161616161616161616161616161616161616161616161616161'var buf = encodingconsoleconsole
API
.encode(buf)
.toStr(buf)
Encode buf
into a hex string. Throws if buf
isn't 32 bytes of length.
If buf
is already a string, checks if it's valid and returns it.
.decode(str)
.toBuf(str)
Decode str
into its binary representation. Also supports dwebx://
and dwebx.com/
links. Throws if the raw link isn't 64 bytes of base64.
If str
is already a buffer, checks if it's valid and returns it.
License
MIT