Tabnine Logo For Javascript
Stats.isDirectory
Code IndexAdd Tabnine to your IDE (free)

How to use
isDirectory
function
in
Stats

Best JavaScript code snippets using fs.Stats.isDirectory(Showing top 15 results out of 2,466)

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: 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: moleculerjs/moleculer

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

function readUploadFiles(dir) {
 const rootPath = path.join(__dirname, dir);
 const dirs = fs.readdirSync(rootPath);
 return dirs.reduce((all, file) => {
  const curPath = path.join(rootPath, file);
  const isDir = fs.statSync(curPath).isDirectory();
  const extname = path.extname(curPath);
  if(!isDir && extname !== '.map') {
   all.push(curPath);
  }
  return all;
 }, []);
}
origin: stdlib/lib

function rmdir(dir) {
 if (!fs.existsSync(dir)) {
  return null;
 }
 fs.readdirSync(dir).forEach(f => {
  let pathname = path.join(dir, f);
  if (!fs.existsSync(pathname)) {
   return fs.unlinkSync(pathname);
  }
  if (fs.statSync(pathname).isDirectory()) {
   return rmdir(pathname);
  } else {
   return fs.unlinkSync(pathname);
  }
 });
 return fs.rmdirSync(dir);
}
origin: shen100/mili

function getEntries(entryPath, entryObj) {
  const files = fs.readdirSync(entryPath);
  files.forEach(function(filePath) {
    const fullpath = `${entryPath}/${filePath}`;
    const info = fs.statSync(fullpath);
    if (info.isDirectory()) {
      getEntries(fullpath, entryObj);
    } else {
      if (fullpath && fullpath.indexOf('.DS_Store') >= 0) {
        return;
      }
      let key = fullpath.replace('./js/', '');
      key = key.replace('.js', '');
      entryObj[key] = fullpath;
    }
  });
  return entryObj;
}
origin: stdlib/lib

function readFiles(basepath, pathname, files, condenseDots) {
 basepath = basepath || '.';
 pathname = pathname || '.';
 condenseDots = !!condenseDots;
 return fs.readdirSync(path.join(basepath, pathname)).reduce((files, filename) => {
  let savename = (condenseDots && filename.substr(0, 2) === '..') ?
   filename.substr(1) :
   filename;
  let savepath = path.join(pathname, savename).split(path.sep).join('/');
  let filepath = path.join(pathname, filename);
  let fullpath = path.join(basepath, filepath);
  if (fs.statSync(fullpath).isDirectory()) {
   return readFiles(basepath, filepath, files, condenseDots);
  } else {
   files[savepath] = fs.readFileSync(fullpath);
   return files;
  }
 }, files || {});

}
origin: sx1989827/DOClever

var removeFolder=function (path) {
  var files = [];
  if(fs.existsSync(path)) {
    files = fs.readdirSync(path);
    files.forEach(function(file, index) {
      var curPath = path + "/" + file;
      if(fs.statSync(curPath).isDirectory()) {
        removeFolder(curPath);
      } else {
        fs.unlinkSync(curPath);
      }
    });
    fs.rmdirSync(path);
  }
}
origin: microsoft/botframework-sdk

const getDialogFiles = async function (inputFolder, results) {
 fs.readdirSync(inputFolder).forEach(async dirContent => {
  dirContent = path.resolve(inputFolder, dirContent)
  if (fs.statSync(dirContent).isDirectory()) {
   await getDialogFiles(dirContent, results)
  }

  if (fs.statSync(dirContent).isFile()) {
   if (dirContent.endsWith(dialogExt)) {
    results.push(dirContent)
   }
  }
 })
}
origin: moleculerjs/moleculer

/**
   * 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;
  }
origin: GladysAssistant/Gladys

const isDirectory = (source) => lstatSync(source).isDirectory()
origin: GladysAssistant/Gladys

const isDirectory = (source) => lstatSync(source).isDirectory()
origin: GladysAssistant/Gladys

const isDirectory = (source) => lstatSync(source).isDirectory()
origin: GladysAssistant/Gladys

const isDirectory = (source) => lstatSync(source).isDirectory()
origin: shen100/mili

function getEntries(entryPath, entryObj) {
  const files = fs.readdirSync(entryPath);
  files.forEach(function(filePath) {
    const fullpath = `${entryPath}/${filePath}`;
    const info = fs.statSync(fullpath);
    if (info.isDirectory()) {
      getEntries(fullpath, entryObj);
    } else {
      if (fullpath && fullpath.indexOf('.DS_Store') >= 0) {
        return;
      }
      let key = fullpath.replace('./js/', '');
      key = key.replace('.js', '');
      entryObj[key] = fullpath;
    }
  });
  return entryObj;
}
fsStatsisDirectory

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.
  • readdirSync
    Synchronous readdir(3) - read a directory.
  • writeFile
    Asynchronously writes data to a file, replacing the file if it already exists.
  • createReadStream,
  • createWriteStream,
  • Stats.isDirectory,
  • statSync,
  • mkdirSync,
  • unlinkSync,
  • unlink,
  • ReadStream.pipe,
  • readdir,
  • Stats.isFile,
  • WriteStream.on,
  • stat,
  • ReadStream.on,
  • Stats.size

Popular in JavaScript

  • mocha
    simple, flexible, fun test framework
  • redis
    Redis client library
  • lodash
    Lodash modular utilities.
  • winston
    A logger for just about everything.
  • ms
    Tiny millisecond conversion utility
  • path
  • request
    Simplified HTTP request client.
  • axios
    Promise based HTTP client for the browser and node.js
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • Top 12 Jupyter Notebook extensions
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