How to use the fs-extra2.outputJsonSync 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 / rules / storage.js View on Github external
if (filesOrder) {
      var curIndex = filesOrder.indexOf(cur);
      if (curIndex !== -1) {
        var nextIndex = filesOrder.indexOf(next);
        if (nextIndex !== -1) {
          return compare(curIndex, nextIndex);
        }
      }
    }
    cur = files[cur];
    next = files[next];
    return compare(cur.index, next.index);
  });
  this._cache.properties['filesOrder'] = filesOrder;
  fse.outputJsonSync(self._properties, self._cache.properties);
  fse.outputJsonSync(self._backupProps, self._cache.properties);
  fs.readdirSync(backupDir).forEach(function(file) {
    if (fileNames[file]) {
      return;
    }
    try {
      fs.unlinkSync(path.join(backupDir, file));
    } catch(e) {}
  });
}
github avwo / whistle / lib / rules / storage.js View on Github external
filesOrder = Object.keys(files).sort(function(cur, next) {
    if (filesOrder) {
      var curIndex = filesOrder.indexOf(cur);
      if (curIndex !== -1) {
        var nextIndex = filesOrder.indexOf(next);
        if (nextIndex !== -1) {
          return compare(curIndex, nextIndex);
        }
      }
    }
    cur = files[cur];
    next = files[next];
    return compare(cur.index, next.index);
  });
  this._cache.properties['filesOrder'] = filesOrder;
  fse.outputJsonSync(self._properties, self._cache.properties);
  fse.outputJsonSync(self._backupProps, self._cache.properties);
  fs.readdirSync(backupDir).forEach(function(file) {
    if (fileNames[file]) {
      return;
    }
    try {
      fs.unlinkSync(path.join(backupDir, file));
    } catch(e) {}
  });
}

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 6 years ago

Package Health Score

55 / 100
Full package analysis