How to use the fs-extra2.outputJson 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
proto._writeProperties = function() {
  var self = this;
  if (self._writePropertiesPending) {
    self._writePropertiesWaiting = true;
    return;
  }
  clearTimeout(self._writePropertiesTimeout);
  self._writePropertiesPending = true;
  fse.outputJson(self._properties, self._cache.properties, function(err) {
    self._writePropertiesPending = false;
    if (err) {
      self._writePropertiesTimeout = setTimeout(self._writeProperties.bind(self), RETRY_INTERVAL);
      logger.error(err);
    } else {
      copyFile(self._properties, self._backupProps, function() {
        if (self._writePropertiesWaiting) {
          self._writePropertiesWaiting = false;
          self._writeProperties();
        }
      });
    }
  });
};

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