Dat's way of encoding and decoding dat links.
var encoding = require('dat-encoding') var link = '6161616161616161616161616161616161616161616161616161616161616161' var buf = encoding.decode(link) console.log('%s -> %s', link, buf) console.log('%s -> %s', buf, encoding.encode(buf))
buf into a hex string. Throws if
buf isn't 32 bytes of length.
buf is already a string, checks if it's valid and returns it.
str into its binary representation. Also supports
dat.com/ links. Throws if the raw link isn't 64 bytes of base64.
str is already a buffer, checks if it's valid and returns it.