fs.readdirSync(inputFolder).forEach(function (dirContent) { dirContent = path.resolve(inputFolder, dirContent); if (getSubFolders && fs.statSync(dirContent).isDirectory()) { results = results.concat(helpers.findLUFiles(dirContent, getSubFolders, extType)); } if (fs.statSync(dirContent).isFile()) { if (dirContent.endsWith(extType)) { results.push(dirContent); } } });
const rmDirFiles = dir => { const dirPath = fs.readdirSync(dir); dirPath.map(item => { const currentPath = path.join(dir, item); console.log(`rmove ${currentPath}`); fileTool.removeSync(currentPath); }); }
// Start listening Promise.fromNode(cb => { api.listen(config.LANDO_API_PORT, cb); }) // Load our routes .then(() => { fs.readdirSync(path.join(__dirname, 'routes')).map(file => { require(`./routes/${file}`)(api, handler, {config, slack}); log.info('Loaded route %s', file); }); log.info('Listening on port: %s', config.LANDO_API_PORT); });
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; }, {}); }
_(fs.readdirSync(baseDir, {withFileTypes: true})) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name) .concat('.') .map(directory => path.resolve(baseDir, directory, '.platform.app.yaml')) .filter(file => fs.existsSync(file)) .map(file => ({data: yamlPlatform.load(fs.readFileSync(file)), file})) .map(data => ({name: data.data.name, file: data.file, dir: path.dirname(data.file)})) .value()
collect() { try { const fds = fs.readdirSync('/proc/self/fd'); // Minus 1 to not count the fd that was used by readdirSync(), // it's now closed. this.set(fds.length - 1); } catch { // noop } }
fs.readdirSync(cmdDir).forEach(function (file) { var command = require(cmdDir + file); if (typeof command === 'object') { Object.keys(command).forEach(function (name) { contextCommand(name, command[name]); }); } else { runtimeCommand(file.substr(0, file.length - 3), command); } });
_(fs.readdirSync(path.join(home, '.terminus', 'cache', 'tokens'))) .map(tokenFile => path.join(home, '.terminus', 'cache', 'tokens', tokenFile)) .map(file => { try { return JSON.parse(fs.readFileSync(file, 'utf8')); } catch (error) { throw Error(`The file ${file} is not valid JSON`); } }) .value()
const getDirectories = (source) => readdirSync(source) .map((name) => join(source, name)) .filter(isDirectory)
fs.readdirSync(themesDir).forEach(th => { if (!th.endsWith(".json")) return; th = th.replace(".json", ""); if (th === window.settings.theme) return; themes += `<option>${th}</option>`; });
// Read all files from that path and load into modules fs.readdirSync(dir).forEach(function (file) { if (file.indexOf('.js') < 0) return; var mod = require(path.join(dir, file)); var name = path.basename(file, '.js'); loaded[name] = mod; });
fs.readdirSync(keyboardsDir).forEach(kb => { if (!kb.endsWith(".json")) return; kb = kb.replace(".json", ""); if (kb === window.settings.keyboard) return; keyboards += `<option>${kb}</option>`; });
fs.readdirSync(themesDir).forEach(th => { if (!th.endsWith(".json")) return; th = th.replace(".json", ""); if (th === window.settings.theme) return; themes += `<option>${th}</option>`; });
// Start listening Promise.fromNode(cb => { api.listen(config.LANDO_API_PORT, cb); }) // Load our routes .then(() => { fs.readdirSync(path.join(__dirname, 'routes')).map(file => { require(`./routes/${file}`)(api, handler, {config, slack}); log.info('Loaded route %s', file); }); log.info('Listening on port: %s', config.LANDO_API_PORT); });
fs.readdirSync(keyboardsDir).forEach(kb => { if (!kb.endsWith(".json")) return; kb = kb.replace(".json", ""); if (kb === window.settings.keyboard) return; keyboards += `<option>${kb}</option>`; });