How to use the temp.cleanup function in temp

To help you get started, we’ve selected a few temp 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 DefinitelyTyped / DefinitelyTyped / types / temp / temp-tests.ts View on Github external
function testCleanup() {
    temp.cleanup(result => {
        if (typeof result === "boolean") {
            const x = result;
        } else {
            const { files, dirs } = result;
            files.toPrecision(4);
            files.toPrecision(4);
        }
    });
}
github FredrikNoren / ungit / source / git-api.js View on Github external
app.post(`${exports.pathPrefix}/testing/cleanup`, ensureAuthenticated, (req, res) => {
      //winston.info('Cleaned up: ' + JSON.stringify(cleaned));
      res.json({ result: temp.cleanup() });
    });
    app.post(`${exports.pathPrefix}/testing/shutdown`, ensureAuthenticated, (req, res) => {
github rolfn / node-gitlab-hook / gitlabhook.js View on Github external
function execute(path, idx) {
    if (idx == cmds.length) {
      if (!self.keep) {
       self.logger.info('Remove working directory: ' + self.path);
       Tmp.cleanup();
      } else {
        self.logger.info('Keep working directory: ' + self.path);
      }
      return;
    }
    var fname = Path.join(path, 'task-' + pad(idx, 3));
    Fs.writeFile(fname, cmds[idx], function (err) {
      if (err) {
        self.logger.error('File creation error: ' + err);
        return;
      }
      self.logger.info('File created: ' + fname);
      execFile(self.cmdshell, [ fname ], { cwd:path, env:process.env },
        function (err, stdout, stderr) {
        if (err) {
          self.logger.error('Exec error: ' + err);