How to use the is-ipfs.ipfsUrl function in is-ipfs

To help you get started, we’ve selected a few is-ipfs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ipfs-shipyard / ipfs-companion / add-on / src / lib / ipfs-path.js View on Github external
function validIpfsOrIpnsUrl (url, dnsLink) {
  // `/ipfs/` is easy to validate, we just check if CID is correct
  if (IsIpfs.ipfsUrl(url)) {
    return true
  }
  // `/ipns/` requires multiple stages/branches (can be FQDN with dnslink or CID)
  if (validIpnsPath(new URL(url).pathname, dnsLink)) {
    return true
  }
  // everything else is not IPFS-related
  return false
}

is-ipfs

A set of utilities to help identify IPFS resources on the web

Apache-2.0 OR MIT
Latest version published 11 months ago

Package Health Score

64 / 100
Full package analysis