(directoryPath: string)
| 22 | import { getOpenAIEmbeddings } from './generate-openai-embeddings'; |
| 23 | |
| 24 | export 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 | |
| 40 | export const getErrorMsg = (error: any, defaultMsg: string) => { |
| 41 | const isErrorMessage = error instanceof Error; |
nothing calls this directly
no test coverage detected