MCPcopy Create free account
hub / github.com/ShipSecAI/studio / downloadArtifact

Function downloadArtifact

frontend/src/store/artifactStore.ts:93–118  ·  view source on GitHub ↗
(artifact, options)

Source from the content-addressed store, hash-verified

91 }
92 },
93 async downloadArtifact(artifact, options) {
94 set((state) => ({
95 downloading: { ...state.downloading, [artifact.id]: true },
96 }));
97 try {
98 const blob = options?.runId
99 ? await api.executions.downloadArtifact(options.runId, artifact.id)
100 : await api.artifacts.download(artifact.id);
101 const url = window.URL.createObjectURL(blob);
102 const link = document.createElement('a');
103 link.href = url;
104 link.download = artifact.name || `artifact-${artifact.id}`;
105 document.body.appendChild(link);
106 link.click();
107 document.body.removeChild(link);
108 window.URL.revokeObjectURL(url);
109 } catch (error) {
110 console.error('Failed to download artifact', error);
111 throw error;
112 } finally {
113 set((state) => {
114 const { [artifact.id]: _removed, ...next } = state.downloading;
115 return { downloading: next };
116 });
117 }
118 },
119 async deleteArtifact(artifactId: string) {
120 set((state) => ({
121 deleting: { ...state.deleting, [artifactId]: true },

Callers 3

RunArtifactsPanelFunction · 0.85
handleDownloadAllFunction · 0.85
ArtifactLibraryFunction · 0.85

Calls 3

errorMethod · 0.80
downloadMethod · 0.65
downloadArtifactMethod · 0.45

Tested by

no test coverage detected