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

Function ensureDir

src/lib/file-util.ts:54–67  ·  view source on GitHub ↗
(dirname: string)

Source from the content-addressed store, hash-verified

52}
53
54export const ensureDir = async (dirname: string): Promise<void> => {
55 try {
56 const fileInfo = await stat(dirname)
57 if (!fileInfo.isDirectory()) {
58 throw Error(`${dirname} already exists but is not a directory`)
59 }
60 } catch (error) {
61 if (error.code === 'ENOENT') {
62 await mkdir(dirname, { recursive: true })
63 } else {
64 throw error
65 }
66 }
67}
68
69export type YAMLFileData = {
70 [key: string]: string | object | number | undefined

Callers 3

copyIfExistsFunction · 0.85
file-util.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected