diff --git a/frontend/sync-client/src/file-operations/filesystem-operations.ts b/frontend/sync-client/src/file-operations/filesystem-operations.ts index 3cab9d2..19d319b 100644 --- a/frontend/sync-client/src/file-operations/filesystem-operations.ts +++ b/frontend/sync-client/src/file-operations/filesystem-operations.ts @@ -1,16 +1,33 @@ import type { RelativePath } from "../persistence/database"; export interface FileSystemOperations { + // List all files that should be synced. listAllFiles: () => Promise; + + // Read the content of a file. read: (path: RelativePath) => Promise; + + // Create or overwrite a file with the given content. write: (path: RelativePath, content: Uint8Array) => Promise; + + // Atomically update the content of a text file. atomicUpdateText: ( path: RelativePath, updater: (currentContent: string) => string ) => Promise; + + // Get the size of a file in bytes. getFileSize: (path: RelativePath) => Promise; + + // Check if a file exists. exists: (path: RelativePath) => Promise; + + // Create a directory at the specified path. All parent directories must already exist. createDirectory: (path: RelativePath) => Promise; + + // Delete a file. It is expected that the path points to an existing file. delete: (path: RelativePath) => Promise; + + // Rename a file. It is expected that the oldPath points to an existing file and the newPath does not exist. rename: (oldPath: RelativePath, newPath: RelativePath) => Promise; }