dat-link-resolve
resolve urls, links to a dat key using common methods
Supports
- Common dat key representations (
dat://
, etc.) - URLs with keys in them (
datproject.org/6161616161616161616161616161616161616161616161616161616161616161
) hyperdrive-key
ordat-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
datResolve(link, callback(err, key))
Link can be string or buffer.
Resolution order:
- Validate buffers or any strings with 64 character hashes in them via dat-encoding
- Check headers in http request
- Check JSON request response for
key
Contributing
Contributions welcome! Please read the contributing guidelines first.