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

x/earthstar/src/entries/npm.ts>IPeer

Storage for private, distributed, offline-first applications.
Go to Latest
interface IPeer
Re-export
import { type IPeer } from "https://deno.land/x/earthstar@v10.2.0/src/entries/npm.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