Need help storing data in local browser by IPFS

Dear community,

What I understood is that I can store data locally in IPFS by a browser when a client doesn’t have IPFS setup by himself, but the browser is having IPFS such as Brave browser, or a client who installed IPFS companion browser plugin in browsers such as Chrome. Am I correct?
How does this work? Which documentation should I follow? Can it be done with vanilla client side javascript and IPFS API?

Kind regards,
Jurjen

Hello,

You can access IPFS via Http when using Js in the browser. See → js-ipfs/packages/ipfs-http-client at master · ipfs/js-ipfs · GitHub

Note that the user MUST configure the node for CORS.

Or you can run an IPFS node directly. See → GitHub - ipfs/js-ipfs: IPFS implementation in JavaScript

1 Like

Hi @SionoiS

Thanks for your reply. In the link you provided I see I have to install some node packages, but we don’t run a server. The code is fully on the client side, eventually provided by an IPFS webpage or any other static source such as github/gitlab pages.

So what code should we provide in that HTML/vanilla javascript to store something new into an IPFS hash that the user entered into a HTML form assuming that the user is running an IPFS node connected to that browser or a browser with IPFS build in such as Brave browser or Chrome with IPFS extension.

Best,
Jurjen

You don’t have to use node see here → js-ipfs/packages/ipfs-http-client at master · ipfs/js-ipfs · GitHub