{"name":"ipfs-http-response","version":"5.0.0-4b4c124c","description":"Creates an HTTP response from an IPFS Hash","author":{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},"license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-http-response#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["http","ipfs","response"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"lint":"aegir lint","clean":"aegir clean","build":"aegir build --no-bundle","test":"aegir test -t node","test:node":"aegir test -t node --cov","dep-check":"aegir dep-check -i global"},"dependencies":{"@libp2p/logger":"^2.0.0","ejs":"^3.1.6","file-type":"^18.0.0","filesize":"^10.0.5","it-map":"^2.0.0","it-reader":"^6.0.1","it-to-stream":"^1.0.0","mime-types":"^2.1.30","p-try-each":"^1.0.1"},"devDependencies":{"@types/ejs":"^3.1.0","@types/mime-types":"^2.1.1","aegir":"^37.11.0","get-stream":"^6.0.0","ipfs-core":"0.17.0-4b4c124c","ipfsd-ctl":"^12.0.3","it-all":"^2.0.0","uint8arrays":"^4.0.2"},"browser":{"file-type":"file-type/browser","fs":false},"readme":"# ipfs-http-response <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> Creates an HTTP response from an IPFS Hash\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Creating HTTP Response](#creating-http-response)\n  - [Using protocol-agnostic resolver](#using-protocol-agnostic-resolver)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-http-response\n```\n\n## Usage\n\n### Creating HTTP Response\n\nThis 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.\n\n```js\nimport { getResponse } from 'ipfs-http-response'\n\nconst result = await getResponse(ipfsNode, ipfsPath)\nconsole.log(result)\n```\n\n### Using protocol-agnostic resolver\n\nThis module also exports the used ipfs `resolver`, which should be used when the response needs to be customized or non-HTTP transport is used:\n\n```js\nimport { resolver } from 'ipfs-http-response'\n\nconst result = await resolver.cid(ipfsNode, ipfsPath)\nconsole.log(result)\n```\n\nIf `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`:\n\n```js\nimport { resolver } from 'ipfs-http-response'\n\nconst result = await resolver.directory(ipfsNode, ipfsPath, cid)\nconsole.log(result)\n```\n\n`result` will be either a `string` with HTML directory listing or an array with CIDs of `index` pages present in inspected directory.\n\n![ipfs-http-response usage](docs/ipfs-http-response.png \"ipfs-http-response usage\")\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless 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.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n","readmeFilename":"README.md","gitHead":"4b4c124c4c49b1c60a68b4b8e24f1f00dd7f0517","_id":"ipfs-http-response@5.0.0-4b4c124c","_nodeVersion":"18.12.1","_npmVersion":"8.19.3","dist":{"integrity":"sha512-xSnwksn3DlEM0FMts82nYrSbr2xOLfEy53cfvAhKkiPU10ETqcBkkdaEES1+Ql+ojN0Sq2qmg3zxAzLFZ13MdA==","shasum":"df11415f227fb5510f89c5cff7b03c0baecdbe01","tarball":"http://registry-npm.ywwl.com/ipfs-http-response/download/ipfs-http-response-5.0.0-4b4c124c.tgz","fileCount":21,"unpackedSize":226824,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHoiK0h2Rr1EpHMoGfJP+UNLiFbVkO6FJihwwDAk6hCzAiEA6LXiPIp5HO06RQJFvn1QwAR8YsBhRXSXF4lIhFXqr3g="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvt5+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr+/g//XccV5J5Ymv+EFqjH9mSBnD9tGZ7hrwPWnQ2n8f25BNCnjmlV\r\nG1+W8A4ctXNNk+AQQI4QTuuK0rrE8H/RTEusg0ApMh8eWa6IsZjQ1Ob8S1TD\r\nVYPKCpULBVE049rSPvA9fjmLg7cRrC5xr2/0pjZ5SkZcmxkmkRXsgGDe1yoK\r\nnkprBaQ4nHV9KH4Y7BSFlbrAuDxV28f8V0lXTu1TVoR9Rc/ZyNXyF01+BFd4\r\n6yePM0GDS7yOzREz8xAxvef0YgktAE39FxLAY9mni/gmsl28IMNANMqgHosf\r\nHAIi/UWe/iD7HUjhckty8P4hYgzxVJHQIF25d26iNrJrkPb6mdguhe256rQs\r\ndJZiXTukhjlzxcAw7YkxJsXxH/ySOL4O7f6sL5NN9FSnbat3q3fkhXGkG46i\r\ndrJivo1Tq2kNoTR56t3yP4tleIa5VlprigzGD37Hi4HaJC9tNv/5+avsEzbz\r\nw/umHCq6OJAQx1GnavmycwR11/12cM8XyC3K1/Id/Shmj44WK5Q25B+8MZsw\r\nlgADBgjNKrA5J2iOLR91+OJnrOZgVpy/4qowL06VAYzN/jCFu8Yyy9OwO/8S\r\nf8GJd64hmQJilYBRdry1EEQkW9VEbfmn9//sEPijJ74OvhZiz3iPO7bKG1Yn\r\nusu6yFUp/l9Nw31b2xE35Hs6TXmDxV5hxCM=\r\n=jNKh\r\n-----END PGP SIGNATURE-----\r\n","size":137519,"noattachment":false,"key":"/ipfs-http-response/-/ipfs-http-response-5.0.0-4b4c124c.tgz"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"vascosantos","email":"santos.vasco10@gmail.com"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-http-response_5.0.0-4b4c124c_1673453182099_0.525890285486007"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details","publish_time":1673453182292,"_cnpm_publish_time":1673453182292,"dist-tags":{"latest":"6.0.1","next":"6.0.0-7b79c1b8"}}