Browser Using the File System Access API

Open
#332 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
typescript
Domain
database

Research direction

Start by comparing the existing IDBBlockstore and IDBDatastore implementations with the Node.js blockstore-fs interface. Review the File System Access API documentation and its browser and security constraints. Done would require a browser-compatible blockstore-FS, an IndexedDB fallback, and resolved design decisions around support, performance, and persistence.

Written by the indexing model from the issue text.

Description

need/triage
Description:

Currently, Helia uses IndexedDB-based blockstore/datastore (IDBBlockstore and IDBDatastore) in the browser. While these work, IndexedDB has limits on storage size and performance. I propose adding a new blockstore implementation for browsers that leverages the File System Access API. This would allow users to choose a local folder for storing blocks, offering:

  • Larger storage capacity: Bypassing some IndexedDB limitations.
  • Better persistence and backup: Data is saved as files on the local filesystem, making it easier to back up or transfer.
  • Potential performance improvements: Direct filesystem access might be faster for some operations.
Implementation:
  • Create a blockstore-FS that follows a similar interface to the Node.js blockstore-fs, but is adapted for the browser using the File System Access API.
  • Provide a fallback to IndexedDB if the File System Access API is not supported.
Open Questions:

I do not fully understand what limitations or trade-offs might arise with this approach. I would love to hear opinions and suggestions from the community on potential challenges, such as issues with cross-browser support, performance, or security. What do you think guys? 🤔

Potential Benefits:
  • More flexibility for apps with high storage needs.
  • Easier backup and transfer of stored data.
  • Improved user experience on supported browsers (e.g., Chrome, Edge).

Feedback and discussion on design details and potential limitations would be greatly appreciated.

Dominant language
TypeScript
Stars
39
Forks
28
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ipfs/js-stores

All issues in ipfs/js-stores

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.