MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / fileExists

Function fileExists

src/lib/file-util.ts:9–19  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

7
8
9export const fileExists = async (path: string): Promise<boolean> => {
10 try {
11 await stat(path)
12 return true
13 } catch (error) {
14 if (error.code === 'ENOENT') {
15 return false
16 }
17 throw error
18 }
19}
20
21export const isFile = async (path: string): Promise<boolean> =>
22 await fileExists(path) && (await stat(path)).isFile()

Callers 4

isFileFunction · 0.85
isDirFunction · 0.85
walkDirFunction · 0.85
file-util.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected