peer-crdt-ipfs
IPFS network and storage adapter for peer-crdt.
Install
$ npm install ipfs peer-crdt peer-crdt-ipfs
Setup
const IPFS = const PeerCRDT = const PeerCrdtIpfs = // Create an IPFS nodeipfs = EXPERIMENTAL: pubsub: true const encrypt = async { return await } const decrypt = async { return await } const options = encrypt decrypt // Create a peer-crdt-ifps config object:const peerCrdtIpfs = // Use it to configure peer-crdtconst CRDT = PeerCRDT // Create and use a CRDT at willconst crdt = CRDT// ...
Options
The constructor exposed in peer-crdt-ipfs
accepts, as the second argument, an object with the following options (defaults in parenthesis):
encrypt
: an async function that accepts a value and resolves to a buffer.decrypt
: inverse function of the above: an async function that accepts a buffer and resolves to a value.minBroadcastInterval
(1000)maxBroadcastInterval
(5000)totalNetworkBroadcastInterval
(1000)dag
- object with:format
('dag-cbor')hashAlg
('sha2-256')
maxAncestorsBroadcast
(10)debounceSetHeadMS
(500)
License
MIT