diff options
Diffstat (limited to 'frontend/lib/drive_server.ts')
| -rw-r--r-- | frontend/lib/drive_server.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/frontend/lib/drive_server.ts b/frontend/lib/drive_server.ts index 2a94fe9..41b9c71 100644 --- a/frontend/lib/drive_server.ts +++ b/frontend/lib/drive_server.ts | |||
| @@ -108,6 +108,18 @@ export async function Drive_rename(oldPath: string, newPath: string, email: stri | |||
| 108 | } | 108 | } |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | /// gets the blob ID for a given path | ||
| 112 | export async function Drive_stat(path: string): Promise<string> { | ||
| 113 | const result = spawnSync('fctdrive', ['stat', path], { encoding: 'utf-8' }); | ||
| 114 | if (result.error) { | ||
| 115 | throw new Error(`Failed to execute fctdrive: ${result.error.message}`); | ||
| 116 | } | ||
| 117 | if (result.status !== 0) { | ||
| 118 | throw new Error(`fctdrive exited with code ${result.status}: ${result.stderr}`); | ||
| 119 | } | ||
| 120 | return result.stdout.trim(); | ||
| 121 | } | ||
| 122 | |||
| 111 | /// builds a filesystem tree from Drive_ls entries | 123 | /// builds a filesystem tree from Drive_ls entries |
| 112 | export async function Drive_tree(): Promise<DriveTreeResponse> { | 124 | export async function Drive_tree(): Promise<DriveTreeResponse> { |
| 113 | const entries = await Drive_ls('/', true); | 125 | const entries = await Drive_ls('/', true); |
