This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

dat-encoding

5.0.2 • Public • Published

deprecated See abstract-encoding and compact-encoding for similar functionality.

More info on active projects and modules at dat-ecosystem.org


dat-encoding

Dat's way of encoding and decoding dat links.

Build Status

Example

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))

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 dat:// and dat.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

Readme

Keywords

none

Package Sidebar

Install

npm i dat-encoding

Weekly Downloads

307

Version

5.0.2

License

MIT

Unpacked Size

8.42 kB

Total Files

7

Last publish

Collaborators

  • cblgh
  • frando
  • jhand
  • juliangruber
  • leichtgewicht
  • ninabreznik
  • pfrazee
  • rangermauve
  • serapath
  • the-real-dk
  • zootella