https://github.com/douganderson444/hydrofile
A small library to sail the seas of IPFS CIDs
https://github.com/douganderson444/hydrofile
Last synced: about 2 months ago
JSON representation
A small library to sail the seas of IPFS CIDs
- Host: GitHub
- URL: https://github.com/douganderson444/hydrofile
- Owner: DougAnderson444
- License: mit
- Created: 2021-04-25T20:36:49.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-05-13T15:39:23.000Z (about 4 years ago)
- Last Synced: 2025-03-25T03:26:01.173Z (2 months ago)
- Language: JavaScript
- Size: 785 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HydroFile
A small wrapper library to sail the seas of IPFS CIDs.
## Dream API
```js
// instantiate a new HydroFile
let hydroFile = new HydroFile()// or load a previously built HydroFile
const hydro = 'badbeefbadbeefbadbeefbadbeefbadbeefbadbeefbadbeef'
hydroFile = new HydroFile(hydro)// TODO: load hydroFile id from Ethereum or ENS?
// name the upload and optionally give it some more meta data, like previous version
const name = "hello.txt" // name what you are saving
const CID = await hydroFile.track(await ipfs.add("Hello world"), { name: "hello.txt" , prevCID, keywords })// or syncronously
ipfs.add("Hello world").then((CID)=>{
hydroFile.track(CID, { name: "hello.txt" , prevCID, keywords })
})const helloRotCID = hydroFile.getRoot(name)
// expect(helloRotCID).to.equal(CID)// all CIDs can be rolled up into one root CID
const rootCID = hydroFile.getRoot()// get last 10 rootCIDs
const rootCIDs = hydroFile.getRoot(10)fileCID = hydroFile.getFile("hello.txt")
const [searchResults] = hydroFile.find("hello") // all CID objects with meta data including "hello" keyword```
## Branches:
main
[json-ld](https://github.com/DougAnderson444/HydroFile/tree/ckartik/jsonld-experiment) (saved in IPLD)
[hyperbee](https://github.com/DougAnderson444/HydroFile/tree/ckartik/ipfs-hyperbee-mvp) (CIDs saved in a hypercore btree)
## Before you start
First clone this repo, install dependencies in the project root and build the project.```bash
$ git clone https://github.com/DougAnderson444/HydroFile.git
$ cd hydrofile
$ npm install
$ npm run start
```
## Architecture
![]()
## Examples
Great 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
```
### Currently working with:
- ...### Planned support for examples using:
- Hyperbee
- Lowdash DB
- JSON LD