MCPcopy Create free account
hub / github.com/SensAI-PT/RAGMeUp / downloadDocument

Function downloadDocument

ui/node-react/client/src/api.js:188–202  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

186}
187
188export async function downloadDocument(filename) {
189 const res = await fetch(`${API_BASE}/documents/download/${encodeURIComponent(filename)}`, {
190 headers: getAuthHeaders(),
191 });
192 if (!res.ok) throw new Error('Download failed');
193 const blob = await res.blob();
194 const url = window.URL.createObjectURL(blob);
195 const a = document.createElement('a');
196 a.href = url;
197 a.download = filename;
198 document.body.appendChild(a);
199 a.click();
200 a.remove();
201 window.URL.revokeObjectURL(url);
202}
203
204export async function deleteDocument(filename) {
205 const res = await fetch(`${API_BASE}/documents/delete`, {

Callers 1

handleDownloadFunction · 0.85

Calls 1

getAuthHeadersFunction · 0.85

Tested by

no test coverage detected