Socket
Socket
Sign inDemoInstall

ipfs-http-response

Package Overview
Dependencies
66
Maintainers
4
Versions
136
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ipfs-http-response

Creates an HTTP response from an IPFS Hash


Version published
Weekly downloads
2.2K
decreased by-26.92%
Maintainers
4
Created
Weekly downloads
 

Readme

Source

⛔️ DEPRECATED: js-IPFS has been superseded by Helia

📚 Learn more about this deprecation or how to migrate

⚠️ If you continue using this repo, please note that security fixes will not be provided

ipfs-http-response

ipfs.tech Discuss codecov CI

Creates an HTTP response from an IPFS Hash

Table of contents

Install

$ npm i ipfs-http-response

Usage

Creating HTTP Response

This project creates a HTTP response for an IPFS Path. This response can be a file, a HTML with directory listing or the entry point of a web page.

import { getResponse } from 'ipfs-http-response'

const result = await getResponse(ipfsNode, ipfsPath)
console.log(result)

Using protocol-agnostic resolver

This module also exports the used ipfs resolver, which should be used when the response needs to be customized or non-HTTP transport is used:

import { resolver } from 'ipfs-http-response'

const result = await resolver.cid(ipfsNode, ipfsPath)
console.log(result)

If ipfsPath points at a directory, resolver.cid will throw Error This dag node is a directory with a cid attribute that can be passed to resolver.directory:

import { resolver } from 'ipfs-http-response'

const result = await resolver.directory(ipfsNode, ipfsPath, cid)
console.log(result)

result will be either a string with HTML directory listing or an array with CIDs of index pages present in inspected directory.

ipfs-http-response usage

License

Licensed under either of

Contribute

Contributions welcome! Please check out the issues.

Also see our contributing document for more information on how we work, and about contributing in general.

Please be aware that all interactions related to this repo are subject to the IPFS Code of Conduct.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Keywords

FAQs

Last updated on 25 May 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc