import { type IReplica } from "https://deno.land/x/earthstar@v9.3.3/mod.browser.ts";
A replica of a share's data, used to read, write, and synchronise data to.
Should be closed using the close
method when no longer being used.
const myReplica = new Replica("+a.a123", Es4Validatior, new ReplicaDriverMemory());
Properties
Methods
Closes the replica, preventing new documents from being ingested or events being emitted.
Any methods called after closing will return ReplicaIsClosedError
.
Returns all documents, including historical versions of documents by other identities.
Returns an array of docs for a given query.
const myQuery = {
filter: {
pathEndsWith: ".txt"
},
limit: 5,
};
const firstFiveTextDocs = await myReplica.queryDocs(myQuery);
Returns an array of all unique authors of documents returned by a given query.
Adds a new document to the replica. If a document signed by the same identity exists at the same path, it will be overwritten.
Overwrite every document from this author, including history versions, with an empty doc.