I’m trying to hash a file and directory structure in plain JavaScript running in the browser, and would like this to work offline. Also, when online I’d rather not spin up a node that automatically sends messages on the network, the operation should be entirely local. Since this is the only IPFS-related task that will be performed, the smaller the dependencies, the better.
This question has already been asked here but I wasn’t sure if necroposting was okay here.
I followed the chain of function calls starting from js-ipfs, and found that it calls the dagBuilder function from ipfs-unixfs-importer which seems to be the point in the call stack where some actual work gets done.
Unfortunately, ipfs-unixfs-importer does not seem to be a module that can be compiled for the browser (e.g. it doesn’t exist on a CDN, only the ipfs-unixfs library exists for browsers, and seems to require manually chunking the file.
I think it’s totally fine as long as it’s the same topic (IMO this is), but it also doesn’t matter too much .
I really like this question as it comes up somewhat frequently, but you’ve made me realise I don’t actually know the solution in-browser. Sorry I don’t have an immediate answer for you.
In the meantime, if you don’t want js-ipfs to communicate with anything else, I’m assuming nulling out the bootstrap list would prevent it from talking: