How to use the fs-extra2.readJson 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 / plugins / index.js View on Github external
Object.keys(obj).forEach(function(name) {
    var pkg = allPlugins[name];
    var newPkg = obj[name];
    if (!pkg || pkg.path != newPkg.path || pkg.mtime != newPkg.mtime) {
      ++count;
      fse.readJson(newPkg.pkgPath, function(err, result) {
        if (result && result.version) {
          var conf = result.whistleConfig || '';
          var hintList = util.getHintList(conf);
          var simpleName = name.slice(0, -1);
          newPkg.version = result.version;
          newPkg.priority = parseInt(conf.priority, 10) || parseInt(result.pluginPriority, 10) || 0;
          newPkg.rulesUrl = util.getCgiUrl(conf.rulesUrl);
          newPkg.valuesUrl = util.getCgiUrl(conf.valuesUrl);
          newPkg.networkMenus = util.getPluginMenu(conf.networkMenus || conf.networkMenu, simpleName);
          newPkg.rulesMenus = util.getPluginMenu(conf.rulesMenus || conf.rulesMenu, simpleName);
          newPkg.valuesMenus = util.getPluginMenu(conf.valuesMenus || conf.valuesMenu, simpleName);
          newPkg[util.PLUGIN_MENU_CONFIG] = util.getPluginMenuConfig(conf);
          newPkg.hintUrl = hintList ? undefined : util.getCgiUrl(conf.hintUrl);
          newPkg.hintList = hintList;
          newPkg.hideShortProtocol = !!conf.hideShortProtocol,
          newPkg.hideLongProtocol = !!conf.hideLongProtocol,

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 3 months ago

Package Health Score

67 / 100
Full package analysis