MCPcopy
hub / github.com/ModelEngine-Group/nexent / selectFile

Function selectFile

frontend/lib/agentImportUtils.ts:130–145  ·  view source on GitHub ↗
(
  accept: string = ".json,.zip"
)

Source from the content-addressed store, hash-verified

128 * Returns null if no file was selected
129 */
130export function selectFile(
131 accept: string = ".json,.zip"
132): Promise<File | null> {
133 return new Promise((resolve) => {
134 const fileInput = document.createElement("input");
135 fileInput.type = "file";
136 fileInput.accept = accept;
137
138 fileInput.onchange = (event) => {
139 const file = (event.target as HTMLInputElement).files?.[0];
140 resolve(file || null);
141 };
142
143 fileInput.click();
144 });
145}
146
147/**
148 * Open import wizard with file selection

Callers 3

handleImportAgentFunction · 0.90
handleImportAgentFunction · 0.90
openImportWizardWithFileFunction · 0.85

Calls 1

resolveFunction · 0.85

Tested by

no test coverage detected