{"id":13421553,"url":"https://github.com/silentcicero/ipfs-mini","last_synced_at":"2025-04-06T10:14:34.634Z","repository":{"id":14311410,"uuid":"76317361","full_name":"SilentCicero/ipfs-mini","owner":"SilentCicero","description":"A super tiny module for querying IPFS that works in the browser and node.","archived":false,"fork":false,"pushed_at":"2022-06-08T22:22:19.000Z","size":41,"stargazers_count":153,"open_issues_count":12,"forks_count":39,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-30T09:09:14.373Z","etag":null,"topics":["api","ethereum","ipfs","module","tiny","web3"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SilentCicero.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-13T03:03:03.000Z","updated_at":"2025-01-16T00:54:54.000Z","dependencies_parsed_at":"2022-07-14T08:18:15.848Z","dependency_job_id":null,"html_url":"https://github.com/SilentCicero/ipfs-mini","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SilentCicero%2Fipfs-mini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SilentCicero%2Fipfs-mini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SilentCicero%2Fipfs-mini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SilentCicero%2Fipfs-mini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SilentCicero","download_url":"https://codeload.github.com/SilentCicero/ipfs-mini/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247464226,"owners_count":20942970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","ethereum","ipfs","module","tiny","web3"],"created_at":"2024-07-30T23:00:24.947Z","updated_at":"2025-04-06T10:14:34.598Z","avatar_url":"https://github.com/SilentCicero.png","language":"JavaScript","funding_links":[],"categories":["Software Development"],"sub_categories":["JavaScript"],"readme":"## ipfs-mini\n\n\u003cdiv\u003e\n  \u003c!-- Dependency Status --\u003e\n  \u003ca href=\"https://david-dm.org/SilentCicero/ipfs-mini\"\u003e\n    \u003cimg src=\"https://david-dm.org/SilentCicero/ipfs-mini.svg\"\n    alt=\"Dependency Status\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- devDependency Status --\u003e\n  \u003ca href=\"https://david-dm.org/SilentCicero/ipfs-mini#info=devDependencies\"\u003e\n    \u003cimg src=\"https://david-dm.org/SilentCicero/ipfs-mini/dev-status.svg\" alt=\"devDependency Status\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- Build Status --\u003e\n  \u003ca href=\"https://travis-ci.org/SilentCicero/ipfs-mini\"\u003e\n    \u003cimg src=\"https://travis-ci.org/SilentCicero/ipfs-mini.svg\"\n    alt=\"Build Status\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- NPM Version --\u003e\n  \u003ca href=\"https://www.npmjs.org/package/ipfs-mini\"\u003e\n    \u003cimg src=\"http://img.shields.io/npm/v/ipfs-mini.svg\"\n    alt=\"NPM version\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- Test Coverage --\u003e\n  \u003ca href=\"https://coveralls.io/r/SilentCicero/ipfs-mini\"\u003e\n    \u003cimg src=\"https://coveralls.io/repos/github/SilentCicero/ipfs-mini/badge.svg\" alt=\"Test Coverage\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- Javascript Style --\u003e\n  \u003ca href=\"http://airbnb.io/javascript/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/code%20style-airbnb-brightgreen.svg\" alt=\"js-airbnb-style\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\nA super tiny module for querying an IPFS node, that works in the browser and in Node. Only **2.76 kB** compressed!\n\nThis module was inspired by [`browser-ipfs`](https://github.com/pelle/browser-ipfs).\n\n## Install\n\n```\nnpm install --save ipfs-mini\n```\n\n## Usage\n\n```js\nconst IPFS = require('ipfs-mini');\nconst ipfs = new IPFS({ host: 'ipfs.infura.io', port: 5001, protocol: 'https' });\n\nipfs.add('hello world!').then(console.log).catch(console.log);\n\n// result null 'QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j'\n\nipfs.cat('QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j', (err, result) =\u003e {\n  console.log(err, result);\n});\n\n// result null 'hello world!'\n\nipfs.addJSON({ somevalue: 2, name: 'Nick' }, (err, result) =\u003e {\n  console.log(err, result);\n});\n\n// result null 'QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j'\n\nipfs.catJSON('QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j').then(console.log).catch(console.log);\n\n// result null { somevalue: 2, name: 'Nick' }\n```\n\n## About\n\nA very simple module for querying an IPFS node. This module works for both `nodejs` and in the browser. It's extremly light, `\u003c3 kB` when compressed.\n\nThis module uses the `js-ipfs-api` module for the adding operations on nodejs. However, in the browser, it uses a very light `FormData` `Blob` handling proceedure which was designed by Pelle Braendgaard, in his `browser-ipfs` module.\n\n## Examples\n\nAn example of the module in use for the browser, can be found in [./example](./examples).\n\nInside is a single, no configuration required, HTML file using the `ipfs-mini` module.\n\n## Browser Usage\n\n`ipfs-mini` is completely browserifiable and webpack ready. The main export found in our distributions [dist](./dist) folder is `IPFS`. There you will find two builds of `ipfs-mini`, one compressed and minified `ipfs-mini.min.js` and one uncompressed `ipfs-mini.js`.\n\n```\n\u003chtml\u003e\n  \u003cbody\u003e\n    \u003cscript type=\"text/javascript\" src=\"ipfs-mini.min.js\"\u003e\n    \u003cscript type=\"text/javascript\"\u003e\n      var ipfs = new IPFS({ provider: 'ipfs.infura.io', protocol: 'https' });\n\n      // ...\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Webpack Figures\n\n**2.76 kB** compressed (not gzipped)\n\n```\nHash: 55d261679ea2edac14af                                                         \nVersion: webpack 2.1.0-beta.15\nTime: 612ms\n        Asset     Size  Chunks             Chunk Names\n    ipfs-mini.js  9.55 kB       0  [emitted]  main\nipfs-mini.js.map    11 kB       0  [emitted]  main\n    + 3 hidden modules\n\nHash: 20584eb8548f596cd97d                                                         \nVersion: webpack 2.1.0-beta.15\nTime: 737ms\n        Asset     Size  Chunks             Chunk Names\nipfs-mini.min.js  2.76 kB       0  [emitted]  main\n    + 3 hidden modules\n```\n\n## API Design\n\n### constructor\n\n[index.js:ipfs-mini](../../../blob/master/src/index.js \"Source code on GitHub\")\n\nIntakes a single provider object, outputs an `ipfs` instance.\n\n**Parameters**\n\n-   `provider` **Object** a single provider object, see `setProvider` for more details\n\nResult output `ipfs` **Object** instance.\n\n```js\nconst IPFS = require('ipfs-mini');\nconst ipfs = new IPFS({ host: 'ipfs.infura.io', port: 5001, protocol: 'https' });\n\nipfs.cat('QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j', (err, result) =\u003e {\n  console.log(err, result);\n});\n```\n\n### setProvider\n\n[index.js:ipfs-mini](../../../blob/master/src/index.js \"Source code on GitHub\")\n\nSets the IPFS instance provider.\n\n**Parameters**\n\n-   `provider` **Object** a single provider object.\n\n    default: `{ host: 'localhost', port: 5001, protocol: 'http', base: '/api/v0' }`\n\nNo result output.\n\n```js\nconst IPFS = require('ipfs-mini');\nconst ipfs = new IPFS();\n\nipfs.setProvider({ host: 'ipfs.infura.io', port: 5001, protocol: 'https' });\n\nipfs.cat('QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j', cb);\n```\n\n### add\n\n[index.js:ipfs-mini](../../../blob/master/src/index.js \"Source code on GitHub\")\n\nQueries `/add` and adds a single String or Buffer data to IPFS, returns an IPFS hash.\n\n**Parameters**\n\n-   `input` **String|Buffer** the input data to be added to IPFS.\n\nResult output `ipfsHash` **String**.\n\n```js\nconst IPFS = require('ipfs-mini');\nconst ipfs = new IPFS({ host: 'ipfs.infura.io', port: 5001, protocol: 'https' });\n\nipfs.add('hello world!', (err, result) =\u003e {\n  console.log(err, result);\n});\n\n// result null 'QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j'\n```\n\n### addJSON\n\n[index.js:ipfs-mini](../../../blob/master/src/index.js \"Source code on GitHub\")\n\nQueries `/add` and adds stringified JSON to IPFS, returns a single ipfs hash.\n\n**Parameters**\n\n-   `input` **Object** the input data to be added to IPFS.\n\nResult output `ipfsHash` **String**.\n\n```js\nconst IPFS = require('ipfs-mini');\nconst ipfs = new IPFS({ host: 'ipfs.infura.io', port: 5001, protocol: 'https' });\n\nipfs.addJSON({ somevalue: 2, name: 'Nick' }, (err, result) =\u003e {\n  console.log(err, result);\n});\n\n// result null 'QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j'\n```\n\n### cat\n\n[index.js:ipfs-mini](../../../blob/master/src/index.js \"Source code on GitHub\")\n\nQueries a `/cat` request, returns data as a String.\n\n**Parameters**\n\n-   `ipfsHash` **String** the ipfs hash string.\n\nResult output `data` **String**.\n\n```js\nconst IPFS = require('ipfs-mini');\nconst ipfs = new IPFS({ host: 'ipfs.infura.io', port: 5001, protocol: 'https' });\n\nipfs.cat('QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j', (err, result) =\u003e {\n  console.log(err, result);\n});\n\n// result null 'Hello world!'\n```\n\n### catJSON\n\n[index.js:ipfs-mini](../../../blob/master/src/index.js \"Source code on GitHub\")\n\nQueries a `/cat` request, returns data as a parsed JSON object.\n\n**Parameters**\n\n-   `ipfsHash` **String** the ipfs hash string.\n\nResult output `data` **Object**.\n\n```js\nconst IPFS = require('ipfs-mini');\nconst ipfs = new IPFS({ host: 'ipfs.infura.io', port: 5001, protocol: 'https' });\n\nipfs.catJSON('QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j', (err, result) =\u003e {\n  console.log(err, result);\n});\n\n// result null { somevalue: 2, name: 'Nick' ...}\n```\n\n### stat\n\n[index.js:ipfs-mini](../../../blob/master/src/index.js \"Source code on GitHub\")\n\nQueries a `/object/stat` request, returns data stats object.\n\n**Parameters**\n\n-   `ipfsHash` **String** the ipfs hash string.\n\nResult output stats `data` **Object**.\n\n```js\nconst IPFS = require('ipfs-mini');\nconst ipfs = new IPFS({ host: 'ipfs.infura.io', port: 5001, protocol: 'https' });\n\nipfs.stat('QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j', (err, result) =\u003e {\n  console.log(err, result);\n});\n\n/* result null {\n  BlockSize: 14595\n  CumulativeSize: 14595\n  DataSize: 14592\n  Hash: \"QmbhrsdhbvQy3RyNiDdStgF4YRVc4arteS3wL5ES5M6cVd\"\n  LinksSize: 3\n  NumLinks: 0\n}\n*/\n```\n\n## Contributing\n\nPlease help better the ecosystem by submitting issues and pull requests to default. We need all the help we can get to build the absolute best linting standards and utilities. We follow the AirBNB linting standard and the unix philosophy.\n\n## Help out\n\nThere is always a lot of work to do, and will have many rules to maintain. So please help out in any way that you can:\n\n- Create, enhance, and debug silentcicero rules (see our guide to [\"Working on rules\"](./github/CONTRIBUTING.md)).\n- Improve documentation.\n- Chime in on any open issue or pull request.\n- Open new issues about your ideas for making `ipfs-mini` better, and pull requests to show us how your idea works.\n- Add new tests to *absolutely anything*.\n- Create or contribute to ecosystem tools, like modules for encoding or contracts.\n- Spread the word.\n\nPlease consult our [Code of Conduct](CODE_OF_CONDUCT.md) docs before helping out.\n\nWe communicate via [issues](https://github.com/silentcicero/ipfs-mini/issues) and [pull requests](https://github.com/silentcicero/ipfs-mini/pulls).\n\n## Important documents\n\n- [Changelog](CHANGELOG.md)\n- [Code of Conduct](CODE_OF_CONDUCT.md)\n- [License](https://raw.githubusercontent.com/silentcicero/ipfs-mini/master/LICENSE)\n\n## Licence\n\nThis project is licensed under the MIT license, Copyright (c) 2016 Nick Dodson. For more information see LICENSE.md.\n\n```\nThe MIT License\n\nCopyright (c) 2016 Nick Dodson. nickdodson.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilentcicero%2Fipfs-mini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilentcicero%2Fipfs-mini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilentcicero%2Fipfs-mini/lists"}