You can find more about the repo option here in the js-ipfs docs.
As for where itâs saved, for me, itâs in the same directory Iâm running my commands from. I donât know how your configuration works, or where that data goes. For me theyâre saved in a directory, with the same name as the repo, assuming I used a custom one. As for not using a custom one, looks like the default location is usually ~/.jsipfs.
Hope that helps!
A great example of how js-ipfs works can actually be found on their homepage, I highly encourage you to check it out: https://js.ipfs.io/
Effectively, you can run a full IPFS node in browser using js-ipfs. Iâm going to be working on an example of using js-ipfs to add data in an application context in the near future.
So understanding itâs a full node, you simply need to have the user add the file to their browser js-ipfs node, and from there if you want, you could have the user broadcast the resulting CID of the file to your nodes, and have them pin the CID for some time, which would help re-share the file if the user exits your app.
Typically if youâre not re-initialising IPFS multiple times in the same run, youâll re-use the same repo. This means when the user returns to your website, the same IPFS repo will load, and theyâll begin re-sharing the file they added once again.
I occasionally find that, there is many indexed db.
For yesterday, await IPFS.create({repo: 'ok'+ Math.random()}) is good solution.
For today, I must find a better one.
Before, in my imagination, the size of one IPFS node, will be hundreds of M or G.
The example will be B/S architecture? Using create-react-app to build?
IPFS nodes can vary in size, generally a browser node wonât be very big, unless the user is intentionally adding lots of data to their node. The example will be a P2P example, IPFS uses libp2p in the background, so most applications are focused on a p2p scenario, without really a main server. User adds data, other users can retrieve it. Itâll be detailed, and you could of course modify it further or just learn from it if you wanted it to do more.
I plan to have it feeling stable. So I want it to feel like you have the benefits of a server handling everything, without actually having to rely on centralisation.
Did you ever end up making the tutorial for the context of applications? I want to be able to start my IPFS node in the browser with all of the existing Repos, but see no other option than âIPFS.create()â I want the option to switch between repos, but keep the current repo for when the page refreshesâŚ
This has a simple solution, when IPFS node is running, the fs will remain lock. This messages indicates that the repo you are trying to get access remain lock.
The people here says to create a new one changing the name⌠Not the best idea.
the best approach is when you are going to exit from the page just close the connection with.
const ipfs = await window.IpfsCore.create({
repo: 'ipfs-1'
});
window.ipfsServer = ipfs;
// DO STUFF
// When you are going to leave the page or you are done....
window.ipfsServer.close(); // <== YOU NEED THIS!
I made a hook that loads on the init of my app.
const useInitIpfs = () => {
const dispatch = useDispatch();
useEffect(() => {
console.log('Init IPFS');
dispatch(fetchInitIpfs() as any); // Here is a dispatch for an async action that launch the fps server.
return () => {
// When unmount, will close ipfs to unlock the repo for the next time
console.log('Closing IPFS');
if (window.ipfsServer) {
window.ipfsServer.close();
}
};
}, []);
};
export default useInitIpfs;