{"id":13482951,"url":"https://github.com/ipfs/js-ipfs-block-service","last_synced_at":"2025-09-30T01:31:26.207Z","repository":{"id":48354808,"uuid":"50644964","full_name":"ipfs/js-ipfs-block-service","owner":"ipfs","description":"JavaScript Implementation of Block and BlockService","archived":true,"fork":false,"pushed_at":"2021-08-11T16:50:59.000Z","size":1455,"stargazers_count":13,"open_issues_count":7,"forks_count":20,"subscribers_count":30,"default_branch":"master","last_synced_at":"2024-04-13T21:59:02.869Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ipfs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-29T07:07:15.000Z","updated_at":"2023-01-28T07:17:12.000Z","dependencies_parsed_at":"2022-08-19T04:40:36.274Z","dependency_job_id":null,"html_url":"https://github.com/ipfs/js-ipfs-block-service","commit_stats":null,"previous_names":["ipfs/js-ipfs-blocks"],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs%2Fjs-ipfs-block-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs%2Fjs-ipfs-block-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs%2Fjs-ipfs-block-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs%2Fjs-ipfs-block-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipfs","download_url":"https://codeload.github.com/ipfs/js-ipfs-block-service/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":201761290,"owners_count":13913732,"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-07-31T17:01:06.989Z","updated_at":"2025-09-30T01:31:20.914Z","avatar_url":"https://github.com/ipfs.png","language":"JavaScript","funding_links":[],"categories":["Modules"],"sub_categories":[],"readme":"⛔️ DEPRECATED: This module has been merged into [ipfs](https://github.com/ipfs/js-ipfs) \u003c!-- omit in toc --\u003e\n======\n\n# IPFS Block Service\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs-block-service)](https://travis-ci.com/ipfs/js-ipfs-block-service)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs-block-service.svg?style=flat-square)](https://david-dm.org/ipfs/js-ipfs-block-service)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n![](https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square)\n![](https://img.shields.io/badge/Node.js-%3E%3D4.0.0-orange.svg?style=flat-square)\n\n\u003e [IPFS][ipfs] implementation of the BlockService and Block data structure in JavaScript.\n\n**BlockService** - A BlockService is a content-addressable store for blocks, providing an API for adding, deleting, and retrieving blocks. A BlockService is backed by an [IPFS Repo][repo] as its datastore for blocks, and uses [Bitswap][bitswap] to fetch blocks from the network.\n\n```markdown\n┌───────────────────┐\n│    BlockService   │\n└───────────────────┘\n     ┌─────┴─────┐\n     ▼           ▼\n┌─────────┐ ┌───────┐\n│IPFS Repo│ |Bitswap│\n└─────────┘ └───────┘\n```\n\n## Lead Maintainer\n\n[Volker Mische](https://github.com/vmx)\n\n## Table of Contents\n\n- [IPFS Block Service](#ipfs-block-service)\n  - [Lead Maintainer](#lead-maintainer)\n  - [Table of Contents](#table-of-contents)\n  - [Install](#install)\n    - [npm](#npm)\n  - [Usage](#usage)\n    - [Node.js](#nodejs)\n    - [Example](#example)\n    - [Browser: Browserify, Webpack, other bundlers](#browser-browserify-webpack-other-bundlers)\n    - [Browser: `\u003cscript\u003e` Tag](#browser-script-tag)\n  - [API](#api)\n  - [Contribute](#contribute)\n  - [License](#license)\n\n## Install\n\n### npm\n\n```sh\n\u003e npm install ipfs-block-service\n```\n\n## Usage\n\n### Node.js\n\n```js\nconst BlockService = require('ipfs-block-service')\n```\n\n\n### Example\n\n```js\nconst BlockService = require('ipfs-block-service')\nconst Block = require('ipld-block')\nconst multihashing = require('multihashing-async')\nconst IPFSRepo = require('ipfs-repo')  // storage repo\nconst uint8ArrayEquals = require('uint8arrays/equals')\nconst uint8ArrayFromString = require('uint8arrays/from-string')\n\n// setup a repo\nconst repo = new IPFSRepo('example')\n\n// create a block\nconst data = uint8ArrayFromString('hello world')\nconst multihash = await multihashing(data, 'sha2-256')\n\nconst cid = new CID(multihash)\nconst block = new Block(data, cid)\n\n// create a service\nconst service = new BlockService(repo)\n\n// add the block, then retrieve it\nawait service.put(block)\n\nconst result = await service.get(cid)\nconsole.log(uint8ArrayEquals(block.data, result.data))\n// =\u003e true\n```\n\n### Browser: Browserify, Webpack, other bundlers\n\n```JavaScript\nvar BlockService = require('ipfs-block-service')\n```\n\n### Browser: `\u003cscript\u003e` Tag\n\nLoading this module through a script tag will make the `IpfsBlockService` obj available in\nthe global namespace.\n\n```html\n\u003cscript src=\"https://unpkg.com/ipfs-block-service/dist/index.min.js\"\u003e\u003c/script\u003e\n\u003c!-- OR --\u003e\n\u003cscript src=\"https://unpkg.com/ipfs-block-service/dist/index.js\"\u003e\u003c/script\u003e\n```\n\n## API\n\nSee https://ipfs.github.io/js-ipfs-block-service\n\n## Contribute\n\nFeel free to join in. All welcome. Open an [issue](https://github.com/ipfs/js-ipfs-block-service/issues)!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n## License\n\n[MIT](LICENSE)\n\n[ipfs]: https://ipfs.io\n[bitswap]: https://github.com/ipfs/specs/tree/master/bitswap\n[repo]: https://github.com/ipfs/specs/tree/master/repo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipfs%2Fjs-ipfs-block-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipfs%2Fjs-ipfs-block-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipfs%2Fjs-ipfs-block-service/lists"}