From 16aac488cc1f94e7f7e424350265f1bd90562405 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sat, 22 Mar 2025 12:01:06 +0000 Subject: [PATCH] Add docs --- .../file-operations/filesystem-operations.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/frontend/sync-client/src/file-operations/filesystem-operations.ts b/frontend/sync-client/src/file-operations/filesystem-operations.ts index 3cab9d2d..19d319ba 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; }