New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ipfs-base

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-base

Utilities to configure Web3 apps for IPFS

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

ipfs-base

Browser utility lib to configure web3 apps for IPFS hosting

npm i ipfs-base -S

API


import { createBase, getBase } from 'ipfs-base'

createBase: (basePath?: string) => string | undefined

Returns the ipfs|ipns base path for the application if currently loaded via a gateway url and injects a <base href={base} /> element into the head of the DOM.

Optional basePath if your application is not deployed at the root of the domain. eg: /base/path

getBase: (basePath?: string) => string | undefined

Returns the current base path with IPFS & IPNS detection.

Optional basePath if your application is not deployed at the root of the domain. eg: /base/path

Example:

  • without IPFS: getBase() => undefined
  • with IPFS: getBase() => '/ipfs|ipns/{hash|domain}'

With a root basePath:

  • without IPFS: getBase('/base/path') => '/base/path
  • with IPFS: getBase('/base/path') => '/ipfs|ipns/{hash|domain}/base/path

Usage with Vue Router

import { createRouter, createWebHistory } from 'vue-router'
import { createBase } from 'ipfs-base'

const router = createRouter({
  history: createWebHistory(createBase()),
  routes
})

Usage with React Router

TODO:

Keywords

FAQs

Package last updated on 16 Jul 2021

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