Tabnine Logo For Javascript
readdirSync
Code IndexAdd Tabnine to your IDE (free)

How to use
readdirSync
function
in
fs

Best JavaScript code snippets using fs.readdirSync(Showing top 15 results out of 4,050)

origin: microsoft/botframework-sdk

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);
        }
      }
    });
origin: hua1995116/webchat

const rmDirFiles = dir => {
  const dirPath = fs.readdirSync(dir);
  dirPath.map(item => {
    const currentPath = path.join(dir, item);
    console.log(`rmove ${currentPath}`);
    fileTool.removeSync(currentPath);
  });
}
origin: lando/lando

// 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);
});
origin: jondot/hygen

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;
 }, {});
}
origin: lando/lando

_(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()
origin: siimon/prom-client

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
      }
    }
origin: rchipka/node-osmosis

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);
  }
});
origin: lando/lando

_(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()
origin: GladysAssistant/Gladys

const getDirectories = (source) =>
 readdirSync(source)
  .map((name) => join(source, name))
  .filter(isDirectory)
origin: GitSquared/edex-ui

fs.readdirSync(themesDir).forEach(th => {
    if (!th.endsWith(".json")) return;
    th = th.replace(".json", "");
    if (th === window.settings.theme) return;
    themes += `<option>${th}</option>`;
  });
origin: ivanseidel/Is-Now-Illegal

// 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;
  });
origin: GitSquared/edex-ui

fs.readdirSync(keyboardsDir).forEach(kb => {
    if (!kb.endsWith(".json")) return;
    kb = kb.replace(".json", "");
    if (kb === window.settings.keyboard) return;
    keyboards += `<option>${kb}</option>`;
  });
origin: GitSquared/edex-ui

fs.readdirSync(themesDir).forEach(th => {
    if (!th.endsWith(".json")) return;
    th = th.replace(".json", "");
    if (th === window.settings.theme) return;
    themes += `<option>${th}</option>`;
  });
origin: lando/lando

// 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);
});
origin: GitSquared/edex-ui

fs.readdirSync(keyboardsDir).forEach(kb => {
    if (!kb.endsWith(".json")) return;
    kb = kb.replace(".json", "");
    if (kb === window.settings.keyboard) return;
    keyboards += `<option>${kb}</option>`;
  });
fsreaddirSync

JSDoc

Synchronous readdir(3) - read a directory.

Most used fs functions

  • readFileSync
    Synchronously reads the entire contents of a file.
  • existsSync
    Synchronously tests whether or not the given path exists by checking with the file system.
  • readFile
    Asynchronously reads the entire contents of a file.
  • writeFile
    Asynchronously writes data to a file, replacing the file if it already exists.
  • writeFileSync
    Synchronously writes data to a file, replacing the file if it already exists.
  • createWriteStream,
  • Stats.isDirectory,
  • statSync,
  • mkdirSync,
  • unlinkSync,
  • unlink,
  • ReadStream.pipe,
  • readdir,
  • Stats.isFile,
  • WriteStream.on,
  • stat,
  • ReadStream.on,
  • Stats.size

4 Minute Read

How to Use Cookies with JavaScript

Popular in JavaScript

  • lodash
    Lodash modular utilities.
  • async
    Higher-order functions and common patterns for asynchronous code
  • minimatch
    a glob matcher in javascript
  • glob
    a little globber
  • mocha
    simple, flexible, fun test framework
  • handlebars
    Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
  • request
    Simplified HTTP request client.
  • superagent
    elegant & feature rich browser / node HTTP with a fluent API
  • commander
    the complete solution for node.js command-line programs
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now