Tool to create a directory with all the configured IPLD format modules and all their versions for adding to IPFS
IPLD formats are modules that enable your IPFS node to read different types of data. 99% of the time you'll be using a format called dag-pb
, which is the default format used by IPFS right now, but other formats exist to allow your IPFS node to read git, bitcoin, ethereum or zcash data.
Currently all of these formats are included in the browser bundle for IPFS to give your node maximum power without having to worry about configuration. However these formats can take up a significant amount of space in the bundle and as more and more formats get added this problem will become worse and worse.
This project extracts browser builds of IPLD format modules and puts them in a directory so they can be added to IPFS. The idea is that IPFS can load an IPLD format on demand from itself, so that they don't have to be included in the browser bundle - reducing it's size without losing functionality!
- Clone this repo
- Install dependencies
npm i
- Add/edit the modules you want to include in the file
formats.json
. By default the tool assumes the browser build is output in a directory calleddist
for each module, but you can customise it by specifying adist
property in the config for a module. - Install any new/missing modules
Example output:
npm run update # outputs to the `dist` folder
dist βββ [email protected] β βββ index.js β βββ index.js.map β βββ index.min.js βββ [email protected] β βββ index.js β βββ index.js.map β βββ index.min.js βββ [email protected] β βββ index.js β βββ index.js.map β βββ index.min.js β βββ index.min.js.map βββ [email protected] β βββ index.js β βββ index.js.map β βββ index.min.js β βββ index.min.js.map βββ [email protected] β βββ index.js β βββ index.js.map β βββ index.min.js βββ [email protected] βββ index.js βββ index.js.map βββ index.min.js
- Deploy to IPFS (Basically:
jsipfs add -r dist
)# Start up your `jsipfs daemon` then... npm run deploy
- Now pin the last hash to IPFS using pinbot or whatever
- You can now
ipfs.cat('/ipfs/QmHash/[email protected]/index.min.js')
or includehttps://ipfs.io/ipfs/QmHash/[email protected]/index.min.js
on your web page.