Skip to content

πŸ—„ Tool to create a directory with all the configured IPLD format modules and all their versions for adding to IPFS

Notifications You must be signed in to change notification settings

alanshaw/ipld-formats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ipld-formats

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!

Usage

  1. Clone this repo
  2. Install dependencies npm i
  3. 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 called dist for each module, but you can customise it by specifying a dist property in the config for a module.
  4. Install any new/missing modules
    npm run update # outputs to the `dist` folder
    Example output:
    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
    
  5. Deploy to IPFS (Basically: jsipfs add -r dist)
    # Start up your `jsipfs daemon` then...
    npm run deploy
  6. Now pin the last hash to IPFS using pinbot or whatever
  7. You can now ipfs.cat('/ipfs/QmHash/[email protected]/index.min.js') or include https://ipfs.io/ipfs/QmHash/[email protected]/index.min.js on your web page.

About

πŸ—„ Tool to create a directory with all the configured IPLD format modules and all their versions for adding to IPFS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published