JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 137
  • Score
    100M100P100Q8538F
  • License MIT

resolve urls, links to a dat key

Package Exports

  • dat-link-resolve

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dat-link-resolve) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

dat-link-resolve

resolve urls, links to a dat key using common methods

npm travis standard

Supports

  • Common dat key representations (dat://, etc.)
  • URLs with keys in them (datproject.org/6161616161616161616161616161616161616161616161616161616161616161)
  • hyperdrive-key or dat-key headers
  • Url to JSON http request that returns {key: <dat-key>}

Install

npm install dat-link-resolve

Usage

var datResolve = require('dat-link-resolve')

datResolve(link, function (err, key) {
  console.log('found key', key)
})

API

Link can be string or buffer.

Resolution order:

  1. Validate buffers or any strings with 64 character hashes in them via dat-encoding
  2. Check headers in http request
  3. Check JSON request response for key

Contributing

Contributions welcome! Please read the contributing guidelines first.

License

MIT