{"id":14956317,"url":"https://github.com/consensysmesh/ipfs.js","last_synced_at":"2025-10-24T09:30:38.056Z","repository":{"id":57276608,"uuid":"41332990","full_name":"ConsenSysMesh/ipfs.js","owner":"ConsenSysMesh","description":"Wrapper for node-ipfs-api","archived":false,"fork":false,"pushed_at":"2016-08-30T13:48:43.000Z","size":953,"stargazers_count":43,"open_issues_count":3,"forks_count":14,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-01-29T09:25:18.166Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ConsenSysMesh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-24T23:58:02.000Z","updated_at":"2024-03-08T20:00:27.000Z","dependencies_parsed_at":"2022-09-17T01:51:53.264Z","dependency_job_id":null,"html_url":"https://github.com/ConsenSysMesh/ipfs.js","commit_stats":null,"previous_names":["consensys/ipfs.js"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsenSysMesh%2Fipfs.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsenSysMesh%2Fipfs.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsenSysMesh%2Fipfs.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsenSysMesh%2Fipfs.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ConsenSysMesh","download_url":"https://codeload.github.com/ConsenSysMesh/ipfs.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237944092,"owners_count":19391588,"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":[],"created_at":"2024-09-24T13:12:42.151Z","updated_at":"2025-10-24T09:30:37.542Z","avatar_url":"https://github.com/ConsenSysMesh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### ⚠️ ATTENTION ⚠️\n\nFor this library to work on both nodejs and the browser, it depends on a old version of js-ipfs-api to avoid a [browserify issue](https://github.com/ipfs/js-ipfs-api/issues/190) with later versions\n\nFor a very lightweight browser-only library, check out [browser-ipfs](https://github.com/pelle/browser-ipfs)\n\nOtherwise if using with node.js or a browser via webpack or `\u003cscript\\\u003e`, you probably want the most recent stable [js-ipfs-api](https://github.com/ipfs/js-ipfs-api)\n\n\n# ipfs.js\n\nWrapper for [node-ipfs-api](https://github.com/ipfs/node-ipfs-api)\n\n## Browser friendly\n\nRun `npm install ipfs-js`\n\nOr reference `dist/ipfs.min.js` inside a `\u003cscript /\u003e` to expose the global `ipfs`\n\n## Example\n\n### 1) Set IPFS CORS access\n\n       ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '[\"*\"]'\n       ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '[\"PUT\", \"GET\", \"POST\"]'\n       ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '[\"true\"]'\n\n### 2) Start IPFS\n\n       ipfs daemon\n\n### 3) Upload example directory\n\n`git clone https://github.com/ConsenSys/ipfs.js \u0026\u0026 cd ipfs.js`\n\nFor non-default ipfs configurations, you can run `./example.url` to `ipfs add -r example` and print the local gateway's url\n\n### 4) Open IPFS gateway\n\nNavigate to the url echoed from `./example.url` in the browser, or run `./example.url | xargs open` to open it on OSX\n\n## Methods\n\n#### `ipfs.setProvider({host: 'localhost', port: '5001'})`\n\n* _localhost_ and _5001_ are the defaults when calling without arguments\n* is also equivalent to `ipfs.setProvider({host: '/ip4/127.0.0.1/tcp/5001'})`\n\n### `ipfs.setProvider(require('ipfs-api')('localhost', '5001'))`\n\nnode.js compatibility for ipfs.js\n\n\n#### `ipfs.add(textOrBuffer, callback)`\n\n\tipfs.add(\"Testing...\", function(err, hash) {\n\t\tif (err) throw err; // If connection is closed\n\t\tconsole.log(hash); \t// \"Qmc7CrwGJvRyCYZZU64aPawPj7CJ56vyBxdhxa38Dh1aKt\"\n\t});\n\n\n#### `ipfs.cat(hash, callback)`\n\n\tipfs.cat(\"Qmc7CrwGJvRyCYZZU64aPawPj7CJ56vyBxdhxa38Dh1aKt\", function(err, buffer) {\n\t\tif (err) throw err;\n\t\tconsole.log(buffer.toString()); \t// \"Testing...\"\n\t});\n\n#### `ipfs.catText(hash, callback)`\n\n\tipfs.cat(\"Qmc7CrwGJvRyCYZZU64aPawPj7CJ56vyBxdhxa38Dh1aKt\", function(err, text) {\n\t\tif (err) throw err;\n\t\tconsole.log(text); \t// \"Testing...\"\n\t});\n\t\n#### `ipfs.addJson(json, callback)`\n\n#### `ipfs.catJson(hash, callback)`\n\n#### `ipfs.api.*`  - all methods from node-ipfs-api\n\n#### `ipfs.utils.base58ToHex(base58)`\n#### `ipfs.utils.hexToBase58(hex)`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsensysmesh%2Fipfs.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconsensysmesh%2Fipfs.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsensysmesh%2Fipfs.js/lists"}