{"id":17586936,"url":"https://github.com/dozyio/js-blockstore-opfs","last_synced_at":"2025-07-08T01:09:52.857Z","repository":{"id":258728008,"uuid":"872703148","full_name":"dozyio/js-blockstore-opfs","owner":"dozyio","description":"OPFS Blockstore for IPFS / Helia","archived":false,"fork":false,"pushed_at":"2024-11-02T02:04:05.000Z","size":2405,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T17:45:36.837Z","etag":null,"topics":["blockstore","ipfs","opfs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/dozyio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-14T23:22:19.000Z","updated_at":"2024-12-09T23:40:31.000Z","dependencies_parsed_at":"2025-01-20T00:26:09.634Z","dependency_job_id":"1421b88f-5785-4377-9cc6-5ab16629d3d7","html_url":"https://github.com/dozyio/js-blockstore-opfs","commit_stats":{"total_commits":38,"total_committers":1,"mean_commits":38.0,"dds":0.0,"last_synced_commit":"1154babfb4ed0707eb7412c4292dedac0c89c3d6"},"previous_names":["dozyio/js-blockstore-opfs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dozyio/js-blockstore-opfs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dozyio%2Fjs-blockstore-opfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dozyio%2Fjs-blockstore-opfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dozyio%2Fjs-blockstore-opfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dozyio%2Fjs-blockstore-opfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dozyio","download_url":"https://codeload.github.com/dozyio/js-blockstore-opfs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dozyio%2Fjs-blockstore-opfs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264171898,"owners_count":23567773,"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":["blockstore","ipfs","opfs"],"created_at":"2024-10-22T03:12:20.195Z","updated_at":"2025-07-08T01:09:52.821Z","avatar_url":"https://github.com/dozyio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OPFS Blockstore\n\nOrigin Private File System TS/JS blockstore implementation for\n[IPFS](https://ipfs.io) / [Helia](https://github.com/ipfs/helia) - for use in\nthe browser.\n\n## Install\n\n```sh\nnpm install blockstore-opfs\n```\n\nor\n\n```sh\nyarn add blockstore-opfs\n```\n\n## Helia Usage\n\n```js\nimport { unixfs } from '@helia/unixfs';\nimport { OPFSBlockstore } from 'blockstore-opfs';\nimport { createHelia } from 'helia';\n\n(async () =\u003e {\n  try {\n    const store = new OPFSBlockstore('bs')\n    await store.open();\n\n    const helia = await createHelia({\n      blockstore: store\n    })\n\n    const fs = unixfs(helia)\n\n    const encoder = new TextEncoder()\n    const cid = await fs.addBytes(encoder.encode('Hello World'))\n\n    console.log('Added file:', cid.toString())\n\n\n    const decoder = new TextDecoder()\n    let text = ''\n\n    for await (const chunk of fs.cat(cid)) {\n      text += decoder.decode(chunk, {\n        stream: true\n      })\n    }\n\n    console.log('Added file contents:', text)\n\n  } catch (err) {\n    console.error(err);\n  }\n})();\n```\n\n## Standalone Usage\n\n```js\nimport { OPFSBlockstore } from 'blockstore-opfs';\nimport { CID } from 'multiformats/cid';\n\n(async () =\u003e {\n  try {\n    const store = new OPFSBlockstore('bs')\n    await store.open();\n\n    // Use the store as you would use any Blockstore\n    const someCid = CID.parse('bafkreigh2akiscaildc6en5ynpwp45fucjk64o4uqa5fmsrzc4i4vqveae')\n    const someData = new Uint8Array([1, 2, 3, 4, 5]);\n\n    await store.put(someCid, someData);\n\n    const data = await store.get(someCid);\n    console.log('Retrieved data:', data);\n\n    store.close()\n  } catch (err) {\n    console.error(err);\n  }\n})();\n```\n\n## Implementation Details\n\n* Uses a web worker implementation for compatability with webkit browsers.\n* See `src-worker` for the web worker wrapper - this is inlined during the build, see `src/opfs-worker.ts`\n* Conforms to [interface-blockstore](https://github.com/ipfs/js-stores/tree/main/packages/interface-blockstore)\n\n\n## View storage quota\n\n```js\nnavigator.storage.estimate()\n```\n\n## Todo\n\n- Benchmarks\n- Sharding\n\n## OPFS Links\n\n- [Specification](https://fs.spec.whatwg.org/)\n- [MDN](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system)\n- [The origin private file system](https://web.dev/articles/origin-private-file-system)\n- [OFPS Explorer brower plugin](https://chromewebstore.google.com/detail/opfs-explorer/acndjpgkpaclldomagafnognkcgjignd?pli=1)\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdozyio%2Fjs-blockstore-opfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdozyio%2Fjs-blockstore-opfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdozyio%2Fjs-blockstore-opfs/lists"}