vault-link/plugin/src/file-operations/file-operations.ts

22 lines
702 B
TypeScript

import { RelativePath } from "src/database/document-metadata";
export interface FileOperations {
listAllFiles(): Promise<RelativePath[]>;
read(path: RelativePath): Promise<Uint8Array>;
getModificationTime(path: RelativePath): Promise<Date>;
create(path: RelativePath, newContent: Uint8Array): Promise<void>;
// Writes new content to the file at the given path. If the file's content has changed since the expectedContent was read, the write will merge the changes.
write(
path: RelativePath,
expectedContent: Uint8Array,
newContent: Uint8Array
): Promise<Uint8Array>;
remove(path: RelativePath): Promise<void>;
move(oldPath: RelativePath, newPath: RelativePath): Promise<void>;
}