@coboxcoop/replicator

base class for replication using multifeed

Usage no npm install needed!

<script type="module">
  import coboxcoopReplicator from 'https://cdn.skypack.dev/@coboxcoop/replicator';
</script>

README

replicator

standard-readme compliant

Table of Contents

About

CoBox is an encrypted p2p file system and distributed back-up tool. README provides a map of the project.

replicator provides a base class for replication. Initialises keys with validations, sets up storage paths, initialises feeds and enables replication.

These are all common functions for any space class, so we can inherit from the replicator class to extend functionality, such as for space, or admin space, which initialize additional but different logs.

Install

npm i -g @coboxcoop/replicator

Usage

const Replicator = require('@coboxcoop/replicator')

// you can either create a replicator instance (see tests), or inherit to add further functionality, e.g.

class MyReplicatorClass extends Replicator {
  constructor (storage, address, identity, opts) {
    super(storage, address, identity, opts)

    // initFeeds must be called to initialize multifeed and storage correctly
    this._initFeeds({})
  }

  ready () {
    this.open(() => {
      // make your replicator ready, call any prep async functions
    })
  }
}

API

See swagger documentation... (we won't have this for a while).

Contributing

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

AGPL-3.0-or-later