/js-ipfs-http-response

Primary LanguageJavaScriptMIT LicenseMIT

js-ipfs-http-response

standard-readme js-standard-style

Creates an HTTP response from an IPFS Hash

Lead Maintainer

Vasco Santos.

Installation

npm install ipfs-http-response

Usage

This project consists on creating a HTTP response from an IPFS Hash. This response can be a file, a directory list view or the entry point of a web page.

const { getResponse } = require('ipfs-http-response')

getResponse(ipfsNode, ipfsPath)
  .then((result) => {
    ...
  })

This module also exports the used ipfs resolver, which should be used when the response needs to be customized.

const { resolver } = require('ipfs-http-response')

resolver.multihash(ipfsNode, ipfsPath)
  .then((result) => {
    ...
  })
const { resolver } = require('ipfs-http-response')

resolver.directory(node, path, multihash)
  .then((result) => {
    ...
  })

ipfs-http-response usage