Add docs
This commit is contained in:
parent
7dcdc98b60
commit
16aac488cc
1 changed files with 17 additions and 0 deletions
|
|
@ -1,16 +1,33 @@
|
||||||
import type { RelativePath } from "../persistence/database";
|
import type { RelativePath } from "../persistence/database";
|
||||||
|
|
||||||
export interface FileSystemOperations {
|
export interface FileSystemOperations {
|
||||||
|
// List all files that should be synced.
|
||||||
listAllFiles: () => Promise<RelativePath[]>;
|
listAllFiles: () => Promise<RelativePath[]>;
|
||||||
|
|
||||||
|
// Read the content of a file.
|
||||||
read: (path: RelativePath) => Promise<Uint8Array>;
|
read: (path: RelativePath) => Promise<Uint8Array>;
|
||||||
|
|
||||||
|
// Create or overwrite a file with the given content.
|
||||||
write: (path: RelativePath, content: Uint8Array) => Promise<void>;
|
write: (path: RelativePath, content: Uint8Array) => Promise<void>;
|
||||||
|
|
||||||
|
// Atomically update the content of a text file.
|
||||||
atomicUpdateText: (
|
atomicUpdateText: (
|
||||||
path: RelativePath,
|
path: RelativePath,
|
||||||
updater: (currentContent: string) => string
|
updater: (currentContent: string) => string
|
||||||
) => Promise<string>;
|
) => Promise<string>;
|
||||||
|
|
||||||
|
// Get the size of a file in bytes.
|
||||||
getFileSize: (path: RelativePath) => Promise<number>;
|
getFileSize: (path: RelativePath) => Promise<number>;
|
||||||
|
|
||||||
|
// Check if a file exists.
|
||||||
exists: (path: RelativePath) => Promise<boolean>;
|
exists: (path: RelativePath) => Promise<boolean>;
|
||||||
|
|
||||||
|
// Create a directory at the specified path. All parent directories must already exist.
|
||||||
createDirectory: (path: RelativePath) => Promise<void>;
|
createDirectory: (path: RelativePath) => Promise<void>;
|
||||||
|
|
||||||
|
// Delete a file. It is expected that the path points to an existing file.
|
||||||
delete: (path: RelativePath) => Promise<void>;
|
delete: (path: RelativePath) => Promise<void>;
|
||||||
|
|
||||||
|
// 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<void>;
|
rename: (oldPath: RelativePath, newPath: RelativePath) => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue