feat: copy page to different space (#1118)

* Add copy page to space endpoint
* copy storage function
* copy function
* feat: copy attachments too
* Copy page - WIP
* fix type
* sync
* cleanup
This commit is contained in:
Philip Okugbe
2025-04-30 14:43:16 +01:00
committed by GitHub
parent 0402f7efb5
commit de7982fe30
17 changed files with 441 additions and 14 deletions

View File

@ -25,6 +25,16 @@ export class LocalDriver implements StorageDriver {
}
}
async copy(fromFilePath: string, toFilePath: string): Promise<void> {
try {
if (await this.exists(fromFilePath)) {
await fs.copy(fromFilePath, toFilePath);
}
} catch (err) {
throw new Error(`Failed to copy file: ${(err as Error).message}`);
}
}
async read(filePath: string): Promise<Buffer> {
try {
return await fs.readFile(this._fullPath(filePath));