const availableActions = templates => { const generators = fs.readdirSync(templates).filter(_ => fs.lstatSync(path.join(templates, _)).isDirectory()); return generators.reduce((acc, generator) => { const actions = fs.readdirSync(path.join(templates, generator)); acc[generator] = actions; return acc; }, {}); }
/** * Check the given path whether a file or not * * @param {String} p * @returns {Boolean} */ isServiceFile(p) { try { return !fs.lstatSync(p).isDirectory(); } catch(_) { // ignore } return false; }
const isDirectory = (source) => lstatSync(source).isDirectory(); const getDirectories = (source) => readdirSync(source)
const stat = fs.lstatSync(absPath); if (stat.isDirectory()) { absPath = path.resolve(absPath, 'index.js');
var fCopyFile = function(srcFile, destFile) { if(typeof opts !== 'undefined' && opts.preserveFiles && fs.existsSync(destFile)) return; var contents = fs.readFileSync(srcFile); fs.writeFileSync(destFile, contents); var stat = fs.lstatSync(srcFile); fs.chmodSync(destFile, stat.mode); if (preserveTimestamps) { fs.utimesSync(destFile, stat.atime, stat.mtime) } }
const isFolder = lstatSync(fullPath).isDirectory(); const extension = path.extname(fullPath); const { size, atime: dateTime } = stat;
files.forEach(function(file) { const pathname = path.join(dir, file); const stat = fs.lstatSync(pathname); if (stat.isDirectory()) { extFiles = extFiles.concat(self.getAllFiles(pathname, ext)); } else if (path.extname(pathname) === ext) { extFiles.push(pathname.replace(cwd, '.')); } });
files.forEach(function(item, index) { const stat = fs.lstatSync(dir + '/' + item); if (stat.isDirectory() === true) { components.push(item); } });
/** * Check the given path whether directory or not * * @param {String} p * @returns {Boolean} */ isDirectory(p) { try { return fs.lstatSync(p).isDirectory(); } catch(_) { // ignore } return false; }
const isDirectory = (source) => lstatSync(source).isDirectory()
const isDirectory = (source) => lstatSync(source).isDirectory()
const isDirectory = (source) => lstatSync(source).isDirectory()
const isDirectory = (source) => lstatSync(source).isDirectory()
const isDirectory = (source) => lstatSync(source).isDirectory(); const getDirectories = (source) => readdirSync(source)
function isDirectory (pathString) { try { return fs.lstatSync(pathString).isDirectory(); } catch (e) { return false; } }