mirror of
https://github.com/ryannhg/elm-spa.git
synced 2024-11-22 09:44:55 +03:00
Merge pull request #43 from drshade/master
check whether the folder exists before attempting to create it, avoid…
This commit is contained in:
commit
7b40c81e17
@ -37,7 +37,7 @@ const listFiles = (dir) =>
|
||||
[])
|
||||
|
||||
const ensureDirectory = (dir) =>
|
||||
fs.mkdirSync(dir, { recursive: true })
|
||||
fs.existsSync(dir) || fs.mkdirSync(dir, { recursive: true })
|
||||
|
||||
const saveToFolder = (prefix) => ({ filepath, content }) =>
|
||||
fs.writeFileSync(path.join(prefix, filepath), content, { encoding: 'utf8' })
|
||||
|
Loading…
Reference in New Issue
Block a user