MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / insertFile

Function insertFile

src/lib/openFolder.js:899–917  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

897 }
898
899 async function insertFile() {
900 startLoading();
901 try {
902 const FileBrowser = await loadFileBrowser();
903 const file = await FileBrowser("file", strings["insert file"]);
904 const sourceFs = fsOperation(file.url);
905 const data = await sourceFs.readFile();
906 const sourceStats = await sourceFs.stat();
907 const insertedFile = await fsOperation(url).createFile(
908 sourceStats.name,
909 data,
910 );
911 appendTile($target, createFileTile(sourceStats.name, insertedFile));
912 FileList.append(url, insertedFile);
913 } catch (error) {
914 } finally {
915 stopLoading();
916 }
917 }
918
919 async function clipBoardAction() {
920 clipBoard.url = url;

Callers 1

execOperationFunction · 0.85

Calls 11

loadFileBrowserFunction · 0.90
FileBrowserFunction · 0.85
fsOperationFunction · 0.85
appendTileFunction · 0.85
createFileTileFunction · 0.85
appendMethod · 0.80
startLoadingFunction · 0.70
stopLoadingFunction · 0.70
createFileMethod · 0.65
readFileMethod · 0.45
statMethod · 0.45

Tested by

no test coverage detected