MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / checkDirectoryExists

Function checkDirectoryExists

packages/baseai/src/utils/memory/lib.ts:24–38  ·  view source on GitHub ↗
(directoryPath: string)

Source from the content-addressed store, hash-verified

22import { getOpenAIEmbeddings } from './generate-openai-embeddings';
23
24export async function checkDirectoryExists(directoryPath: string) {
25 try {
26 await fs.promises.access(directoryPath);
27 return {
28 data: true,
29 error: null
30 };
31 } catch (error: any) {
32 console.log('utils/memory/lib.ts: checkDirectoryExists: error:', error);
33 return {
34 data: null,
35 error: getErrorMsg(error, 'Error checking directory exists')
36 };
37 }
38}
39
40export const getErrorMsg = (error: any, defaultMsg: string) => {
41 const isErrorMessage = error instanceof Error;

Callers

nothing calls this directly

Calls 2

getErrorMsgFunction · 0.85
logMethod · 0.80

Tested by

no test coverage detected