Add save actions and cross-platform file manager support (#848)

* files-download-feature

* feat: add save option to file directory context menus and viewer

* fix: open files in the system file manager
This commit is contained in:
Dave Otero
2026-04-16 23:33:55 +03:00
committed by GitHub
parent 79a9f93ae2
commit fd8972a7d9
7 changed files with 102 additions and 6 deletions
+11 -1
View File
@@ -115,7 +115,6 @@ export const createVSCodeFilesAPI = (): FilesAPI => ({
async execCommands(commands: string[], cwd: string): Promise<{ success: boolean; results: CommandExecResult[] }> {
const targetCwd = normalizePath(cwd);
// Use extended timeout for command execution (5 minutes)
const data = await sendBridgeMessageWithOptions<{ success: boolean; results?: CommandExecResult[] }>('api:fs:exec', {
commands,
cwd: targetCwd,
@@ -126,4 +125,15 @@ export const createVSCodeFilesAPI = (): FilesAPI => ({
results: Array.isArray(data?.results) ? data.results : [],
};
},
async downloadFile(path: string): Promise<void> {
const target = normalizePath(path);
const url = `/api/fs/raw?path=${encodeURIComponent(target)}&download=true`;
const a = document.createElement('a');
a.href = url;
a.download = target.split('/').pop() || 'file';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
},
});