ChluNetwork / chlu-ipfs-support

Support libs to talk to IPFS
MIT License
1 stars 1 forks source link

Chlu IPFS Support

This is a work in progress implementation of the IPFS integration of Chlu.

See CONTRIBUTING.md to hack on the code.

Usage

This module has not been released to NPM yet. Check out index.js to see the exposed API calls, read the API docs linked below or check out the examples.

In Node

Just require this module, then check out the JS API Docs below for usage information.

In the Browser

You can require/import this module from the browser through Webpack. Check out this example for the additional configuration needed by js-ipfs.

If you use create-react-app and don't want to eject, there is an issue preventing you from using IPFS or any library that depends on IPFS because the IPFS code is not transpiled to ES5 and the uglify version used by create-react-app as of now does not support ES6 code and crashes when encountering it. This will prevent you from making a production build of your app, but thankfully there is a workaround you can use: be careful to remove -c and -m options from the uglify-es call since they don't play well with IPFS.

For more information either check how we are building chlu-demo or open an issue.

If you don't have webpack, we also have a prebuilt minified version of the library that you can include in a <script> tag. Check out the examples.

In Electron

This is not supported right now, however everything should work if you follow the browser instructions and only run ChluIPFS in the renderer process of electron. Keep in mind that you will run into the same limitations of running ChluIPFS in the browser, and that this is not tested.

Hacking on the code

Check out CONTRIBUTING

Running a Collector

Check out the Chlu Collector README.

Running Offline

Check out the Chlu Collector README.

JS API Docs

https://ipfs.io/ipfs/QmZ2QNSTNwt61jrMQccZYd3uc5V626nafg6Fz2khDhQmNp

Events

You can access the event emitter at chluIpfs.instance.events and listen to some events:

Examples

// Create a ChluIPFS node
const chluIpfs = new ChluIPFS()
// Start the node. It is possible to modify internal modules or set an existing IPFS instance
// to be used while the node has not been started yet
await chluIpfs.start() // this operation is async. Wait for the promise to resolve before doing anything else
// ChluIPFS logs to console in debug level by default. Pass a custom logger object to the constructor to
// change this behavior. The methods that the logger should contain are error, warn, info and debug
// Check out the JS API Docs above for more

Also check out the browser examples

Note: browser examples are severely outdated and need refactoring

Undocumented differences from the protocol

Note: This section is severely outdated and needs reviewing.

This is a collection of features and design choices not compatible with the Chlu Protocol. They exist to allow this to work before the protocol is finalized.

Chlu Service Nodes:

Writing Reviews:

All of these are subject to change.