MCPcopy Create free account
hub / github.com/Xyntopia/taskyon / checkFileExists

Function checkFileExists

src/modules/OPFS.ts:62–75  ·  view source on GitHub ↗
(
  directoryHandle: FileSystemDirectoryHandle,
  fileName: string
)

Source from the content-addressed store, hash-verified

60}
61
62async function checkFileExists(
63 directoryHandle: FileSystemDirectoryHandle,
64 fileName: string
65): Promise<boolean> {
66 try {
67 await directoryHandle.getFileHandle(fileName);
68 return true;
69 } catch (e) {
70 if (e instanceof Error && e.name === 'NotFoundError') {
71 return false;
72 }
73 throw e;
74 }
75}
76
77function addSuffixToFile(fileName: string, suffix: number): string {
78 const dotIndex = fileName.lastIndexOf('.');

Callers 1

writeFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected