How to use the fs-extra2.ensureFile function in fs-extra2

To help you get started, we’ve selected a few fs-extra2 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 avwo / whistle / lib / util / index.js View on Github external
fs.stat(file, function(err, stat) {
    if (!err) {
      return execCallback();
    }
    logger.warn(err);
    fse.ensureFile(file, function(err) {
      execCallback(err ? null : fs.createWriteStream(file).on('error', logger.error));
      logger.error(err);
    });
  });
}

fs-extra2

fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.

MIT
Latest version published 7 months ago

Package Health Score

64 / 100
Full package analysis