A small wrapper library to sail the seas of IPFS CIDs.
// instantiate a new HydroFilelethydroFile=newHydroFile()// or load a previously built HydroFileconsthydro='badbeefbadbeefbadbeefbadbeefbadbeefbadbeefbadbeef'hydroFile=newHydroFile(hydro)// TODO: load hydroFile id from Ethereum or ENS?// name the upload and optionally give it some more meta data, like previous version constname="hello.txt"// name what you are savingconstCID=awaithydroFile.track(awaitipfs.add("Hello world"),{name: "hello.txt", prevCID, keywords })// or syncronouslyipfs.add("Hello world").then((CID)=>{hydroFile.track(CID,{name: "hello.txt", prevCID, keywords })})consthelloRotCID=hydroFile.getRoot(name)// expect(helloRotCID).to.equal(CID)// all CIDs can be rolled up into one root CIDconstrootCID=hydroFile.getRoot()// get last 10 rootCIDsconstrootCIDs=hydroFile.getRoot(10)fileCID=hydroFile.getFile("hello.txt")const[searchResults]=hydroFile.find("hello")// all CID objects with meta data including "hello" keywordmain
json-ld (saved in IPLD)
hyperbee (CIDs saved in a hypercore btree)
First clone this repo, install dependencies in the project root and build the project.
$ git clone https://github.com/DougAnderson444/HydroFile.git
$ cd hydrofile
$ npm install
$ npm run startGreat example usage in the tests.
To run the tests, simply run mocha in the dictory
mocha
or have npm run the test script from package.json;
npm run test
- ...
- Hyperbee
- Lowdash DB
- JSON LD
