import { type IReplicaAttachmentDriver } from "https://deno.land/x/earthstar@v10.0.1/src/replica/replica-types.ts";
An attachment driver provides low-level access to a replica's attachments. ReplicaAttachmentDrivers are not meant to be used directly by users; let the Replica talk to it for you.
Methods
getAttachment(formatName: string, attachmentHash: string): Promise<DocAttachment | undefined>
Returns an attachment for a given format and hash.
stage(formatName: string, attachment: Uint8Array | ReadableStream<Uint8Array>): Promise<{ hash: string; size: number; commit: () => Promise<void>; reject: () => Promise<void>; } | ValidationError>
Upserts the attachment to a staging area, and returns an object used to assess whether it is what we're expecting.
erase(formatName: string, attachmentHash: string): Promise<true | ValidationError>
Erases an attachment for a given format and hash.