ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.44k stars 1.25k forks source link

ipfs-core allow content read while node is booting #4245

Closed streamich closed 1 year ago

streamich commented 1 year ago

When using ipfs-core in a browser it takes seconds to wait for await create() call to instantiate an IPFS node, connect to peers, etc..

However, during that time the locally cached content from IndexDB could be already used, at least in read-only mode. Is there a way to at least do reads, maybe writes, towards the IndexDB cache while the node is booting up?

welcome[bot] commented 1 year ago

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

Finally, remember to use https://discuss.ipfs.io if you just need general support.

streamich commented 1 year ago

Would be great if create() call returned "repo" as soon as storage is initialized, for example:

await create({
  onRepo: repo => {
    // Repo is ready...
  },
});
streamich commented 1 year ago

Also, would be good to support "offline" mode in ipfs-core, at least read requests can be served from the local block store.

achingbrain commented 1 year ago

js-IPFS is in the process of being deprecated, the replacement is Helia - please see the State of IPFS in JS post for a bit of background and the migration guide for how to port your app over.

With Helia (and js-IPFS tbh) you can pass start: false to the create factory which essentially makes it offline - you can then access the repo/blockstore etc and call node.start() at your leisure to make it online.