UNPKG

gumbajs

Version:

Component code generator for projects done with AEM and Sightly.

17 lines (12 loc) 392 B
'use strict'; const fs = require('promised-io/fs'); const rimraf = require('rimraf-promise'); module.exports.removeFolder = path => { return folderExists(path).then(rimraf(path)); }; module.exports.createFolder = path => { return folderExists(path).catch(() => fs.mkdir(path)); }; function folderExists(path) { return Promise.resolve().then(() => fs.access(path, fs.F_OK)); }