Skip to main content
Module

x/earthstar/mod.ts>IPeer

Earthstar is a tool for private, undiscoverable, offline-first networks.
Go to Latest
interface IPeer
Re-export
import { type IPeer } from "https://deno.land/x/earthstar@v10.0.0-alpha.2/mod.ts";

Holds many shares' replicas and manages their synchronisation with other peers. Recommended as the point of contact between your application and Earthstar shares.

Methods

hasShare(share: ShareAddress): boolean
shares(): ShareAddress[]
replicas(): Replica[]
size(): number
getReplica(share: ShareAddress): Replica | undefined
addReplica(replica: Replica): Promise<void>
removeReplicaByShare(share: ShareAddress): Promise<void>
removeReplica(replica: Replica): Promise<void>
sync<F>(
target: IPeer | string,
live?: boolean,
formats?: FormatsArg<F>,
): Syncer<undefined, F>
onReplicasChange(callback: (map: Map<ShareAddress, Replica>) => void | Promise<void>): () => void