How to use the memfs.fs.lstatSync function in memfs

To help you get started, we’ve selected a few memfs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MarkBind / markbind / __mocks__ / fs-extra-promise.js View on Github external
fs.removeAsync = pathArg => new Promise((resolve, reject) => {
  try {
    if (fs.lstatSync(pathArg).isDirectory()) {
      rimraf(pathArg);
    } else {
      fs.unlinkSync(pathArg);
    }
    resolve();
  } catch (err) {
    reject(err);
  }
});
github MarkBind / markbind / __mocks__ / fs-extra-promise.js View on Github external
function copyDirSync(src, dest) {
  if (fs.lstatSync(src).isDirectory()) {
    const files = fs.readdirSync(src);
    files.forEach((file) => {
      const curSource = path.join(src, file);
      const curDest = path.join(dest, file);
      if (fs.lstatSync(curSource).isDirectory()) {
        if (!fs.existsSync(curDest)) {
          createDir(curDest);
        }
        copyDirSync(curSource, curDest);
      } else {
        copyFileSync(curSource, curDest);
      }
    });
  }
}
github MarkBind / markbind / __mocks__ / fs-extra-promise.js View on Github external
function copyFileSync(src, dest) {
  if (!fs.lstatSync(src).isFile()) {
    throw new Error(`copyFileSync expected file but got: ${src}`);
  }
  fs.writeFileSync(dest, fs.readFileSync(src));
}
github MarkBind / markbind / __mocks__ / fs-extra-promise.js View on Github external
fs.readdirSync(dirPath).forEach((entry) => {
      const entryPath = path.join(dirPath, entry);
      if (fs.lstatSync(entryPath).isDirectory()) {
        rimraf(entryPath);
      } else {
        fs.unlinkSync(entryPath);
      }
    });
    fs.rmdirSync(dirPath);
github MarkBind / markbind / __mocks__ / fs-extra-promise.js View on Github external
files.forEach((file) => {
      const curSource = path.join(src, file);
      const curDest = path.join(dest, file);
      if (fs.lstatSync(curSource).isDirectory()) {
        if (!fs.existsSync(curDest)) {
          createDir(curDest);
        }
        copyDirSync(curSource, curDest);
      } else {
        copyFileSync(curSource, curDest);
      }
    });
  }
github MarkBind / markbind / __mocks__ / fs-extra-promise.js View on Github external
fs.copySync = (src, dest) => {
  if (fs.lstatSync(src).isDirectory()) {
    copyDirSync(src, dest);
  } else {
    copyFileSync(src, dest);
  }
};