import { AttachmentInput, MinimalBackupData, PHBaseState, PHDocument, Reducer, ReplayDocumentOptions } from "@powerhousedao/shared/document-model"; import { BinaryLike } from "node:crypto"; //#region node.d.mts /** * Reads an attachment from a file and returns its base64-encoded data and MIME type. * @param path - The path of the attachment file to read. * @returns A Promise that resolves to an object containing the base64-encoded data and MIME type of the attachment. */ declare function getLocalFile(path: string): Promise; /** * Fetches an attachment from a URL and returns its base64-encoded data and MIME type. * @param url - The URL of the attachment to fetch. * @returns A Promise that resolves to an object containing the base64-encoded data and MIME type of the attachment. */ declare function getRemoteFile(url: string): Promise; declare function writeFileNode(path: string, name: string, data: Uint8Array): Promise; declare function readFileNode(path: string): NonSharedBuffer; declare function fetchFileNode(url: string): Promise<{ buffer: Buffer; mimeType?: string; }>; declare const getFileNode: (file: string) => Promise; declare const hashNode: (data: BinaryLike, algorithm?: string, encoding?: "base64" | "hex", _params?: Record) => string; /** * Loads a document from a ZIP file. * * @remarks * This function reads a ZIP file and returns the document state after * applying all the operations. The reducer is used to apply the operations. * * @typeParam S - The type of the state object. * @typeParam A - The type of the actions that can be applied to the state object. * * @param path - The path to the ZIP file. * @param reducer - The reducer to apply the operations to the state object. * @returns A promise that resolves to the document state after applying all the operations. * @throws An error if the initial state or the operations history is not found in the ZIP file. */ declare function baseLoadFromFile(path: string, reducer: Reducer, options?: ReplayDocumentOptions): Promise>; /** * Saves a minimal document backup to a .phd file. * Used when the full document is not available (e.g., in onOperations handler). * Creates a file with minimal header and empty operations. */ declare function baseMinimalSaveToFile(data: MinimalBackupData, path: string, extension: string): Promise; /** * Saves a document to a ZIP file. * * @remarks * This function creates a ZIP file containing the document's state, operations, * and file attachments. The file is saved to the specified path. * * @param document - The document to save to the file. * @param path - The path to save the file to. * @param extension - The extension to use for the file. * @returns A promise that resolves to the path of the saved file. */ declare function baseSaveToFile(document: PHDocument, path: string, extension: string, name?: string): Promise; //#endregion export { baseLoadFromFile, baseMinimalSaveToFile, baseSaveToFile, fetchFileNode, getFileNode, getLocalFile, getRemoteFile, hashNode, readFileNode, writeFileNode }; //# sourceMappingURL=node.d.mts.map