Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dat-encoding

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dat-encoding

Encode and decode Dat links

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
201
increased by14.2%
Maintainers
1
Weekly downloads
 
Created
Source

dat-encoding

Dat's way of encoding and decoding dat links. Pretty similar to base36!

Build Status

Example

var encoding = require('dat-encoding')

var link = '2fdiu7i6kpzx4h9qos6eqldjghd2ut5hx0e8bekm0bkwiax3dt'
var buf = encoding.decode(link)
console.log('%s -> %s', link, buf)
console.log('%s -> %s', buf, encoding.encode(buf))

API

.encode(buf)

Encode buf into a string that works well in urls. Throws if buf isn't 32 bytes of length.

.decode(str)

Decode str into its binary representation. If str is a 64 character legacy link, simply applies hex decoding. Also supports dat:// and dat.com/ links. Throws if the raw link isn't 64 bytes of base64 or 50 bytes of base36.

License

MIT

FAQs

Package last updated on 20 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc