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

is-ipfs

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-ipfs

A set of utilities to help identify IPFS resources

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25K
decreased by-17.77%
Maintainers
1
Weekly downloads
 
Created
Source

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('https://ipfs.io/ipfs/QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o') // true
isIPFS.url('https://ipfs.io/ipfs/github.com') // true
isIPFS.url('https://github.com/ipfs/js-ipfs/blob/master/README.md') // false
isIPFS.url('https://google.com') // false

isIPFS.ipfsUrl('https://ipfs.io/ipfs/QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o') // true
isIPFS.ipfsUrl('https://ipfs.io/ipfs/github.com') // false

isIPFS.ipnsUrl('https://ipfs.io/ipfs/QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o') // false
isIPFS.ipnsUrl('https://ipfs.io/ipfs/github.com') // true

API

isIPFS.multihash(hash)

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

isIPFS.url(url)

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

isIPFS.ipfsUrl(url)

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

isIPFS.ipnsUrl(url)

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

Note: the regex used for these checks is also exported as isIPFS.urlPattern

License

MIT

Keywords

FAQs

Package last updated on 03 Feb 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