Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/earthstar/src/peer/peer-types.ts>IPeer

Earthstar is a tool for private, undiscoverable, offline-first networks.
Go to Latest
interface IPeer
import { type IPeer } from "https://deno.land/x/earthstar@v10.0.0-beta.5/src/peer/peer-types.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,
continuous?: boolean,
formats?: FormatsArg<F>,
): Syncer<unknown, F>
addSyncPartner<I, F>(
partner: ISyncPartner<I>,
description: string,
formats?: FormatsArg<F>,
): Syncer<unknown, F>
getSyncers(): Map<string, { description: string; syncer: Syncer<unknown, unknown>; }>
onReplicasChange(callback: (map: Map<ShareAddress, Replica>) => void | Promise<void>): () => void
onSyncersChange(callback: (map: Map<string, { description: string; syncer: Syncer<unknown, unknown>; }>) => void | Promise<void>): () => void