JSPM

  • Created
  • Published
  • Downloads 90505
  • Score
    100M100P100Q147872F
  • License MIT

A set of utilities to help identify IPFS resources

Package Exports

  • is-ipfs

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 (is-ipfs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

is-ipfs

build status js-standard-style

A set of utilities to help identify IPFS resources.

Install

npm i --save is-ipfs

Usage

const isIPFS = require('is-ipfs')

isIPFS.multihash('QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o') // true
isIPFS.multihash('noop') // false

isIPFS.url('http://ipfs.io/ipfs/QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o') // true
isIPFS.url('https://github.com/ipfs/js-ipfs/blob/master/README.md') // false
isIPFS.url('https://google.com') // false

API

isIPFS.multihash(hash)

Returns true if the provided string is a valid multihash or false otherwise.

isIPFS.url(hash)

Returns true if the provided string is a valid IPFS url or false otherwise.

Note: the regex used for this check is also exported as isIPFS.urlPattern

License

MIT