How to use the temp.mkdir 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 alabid / flylatex / routes.js View on Github external
Document.findOne({_id:documentId}, function(err, doc) {
    if (err || !doc) {
      response.errors.push("An Error Occured while"
                           + " trying to open the document");
      res.json(response);
      return;
    }

    // get the document text
    var docText = doc.data;

    // make temporary directory to create and compile latex pdf
    temp.mkdir("pdfcreator", createAndCompile(docText));
  });
};
github EvanOxfeld / node-unzip / test / uncompressed.js View on Github external
test("extract uncompressed archive", function (t) {
  var archive = path.join(__dirname, '../testData/uncompressed/archive.zip');

  temp.mkdir('node-unzip-', function (err, dirPath) {
    if (err) {
      throw err;
    }
    var unzipExtractor = unzip.Extract({ path: dirPath });
    unzipExtractor.on('error', function(err) {
      throw err;
    });
    unzipExtractor.on('close', testExtractionResults);

    fs.createReadStream(archive).pipe(unzipExtractor);

    function testExtractionResults() {
      dirdiff(path.join(__dirname, '../testData/uncompressed/inflated'), dirPath, {
        fileContents: true
      }, function (err, diffs) {
        if (err) {
github walmartlabs / circus / test / bootstrap.js View on Github external
beforeEach(function(done) {
    temp.mkdir('loader-plugin', function(err, dirPath) {
      if (err) {
        throw err;
      }

      outputDir = dirPath;

      var runner = fs.readFileSync(__dirname + '/client/runner.js');
      fs.writeFileSync(outputDir + '/runner.js', runner);

      var html = fs.readFileSync(__dirname + '/client/initial-route.html');
      fs.writeFileSync(outputDir + '/index.html', html);

      done();
    });
  });
  afterEach(function() {
github bleenco / bproxy / test / utils / helpers.ts View on Github external
return new Promise((resolve, reject) => {
    const rand = Math.random().toString(36).substr(2, 9);
    mkdir(rand, (err: any, dirPath: string) => {
      if (err) {
        reject(err);
      } else {
        resolve(dirPath);
      }
    });
  });
}
github Bart6114 / scheduleR / app / cron / start.tasks.server.js View on Github external
runScript = config.runRmarkdown;

  } else {
    runScript = config.runRscript;
  }

  console.log('Running task: ' + task.name + ' -- from file: ' + task.scriptOriginalFilename);


  var resp = '';
  var log = new Log({
    task: task._id
  });


  temp.mkdir('scheduleR', function(err, dirPath) {

    var args = config.userConfig.RstandardArguments.concat(
      [runScript,
        dirPath,
        path.normalize(config.userConfig.uploadDir + '/' + task.scriptNewFilename),
        task.arguments
      ]);

    var child = spawn(config.userConfig.RscriptExecutable, args);


    child.on('error', function(err) {
      console.log(err);
    });

    child.stdout.on('data', function(buffer) {
github FreeAllMedia / akiro / es6 / spec / builders / nodejs / akiroBuilder / akiroBuilder.installPackage.spec.js View on Github external
beforeEach((done) => {
		temp.mkdir("akiroBuilder", (error, newTemporaryDirectoryPath) => {
			temporaryDirectoryPath = newTemporaryDirectoryPath;
			done();
		});
	});
github steffenmllr / docker-butler / lib / butler.js View on Github external
return new Promise(function (resolve, reject) {
        Temp.mkdir('dockerButler', function(err, dirPath) {
            if(err) { return reject(err); }
            self.log('Generated Tmp dir in: ' + dirPath);
            self._dirPath = dirPath;

            spawn('git', ['clone', '--branch=' + self.config.branch,  '--depth=1', self.config.git, dirPath])
                .progress(function(childProcess) {
                    childProcess.stderr.on('data', function(data) {
                        self.log(data.toString());
                    });
                })
                .then(resolve)
                .catch(reject);
        });
    });
};
github FredrikNoren / ungit / source / git-api.js View on Github external
app.post(exports.pathPrefix + '/testing/createtempdir', ensureAuthenticated, function(req, res){
      temp.mkdir('test-temp-dir', function(err, path) {
        res.json({ path: path });
      });
    });
    app.post(exports.pathPrefix + '/testing/createfile', ensureAuthenticated, function(req, res){
github enyojs / ares-project / hermes / lib / project-gen.js View on Github external
function processZipFile(item, next) {
				log.info("generate#processZipFile()", "Processing " + item.url);
				
				temp.mkdir({prefix: 'com.hp.ares.gen.processZipFile'}, (function(err, zipDir) {
					async.series([
						unzipFile.bind(this, item, options, this.config, zipDir),
						removeExcludedFiles.bind(this, item, options, zipDir),
						prefix.bind(this, item, options, zipDir, destination)
					], next);
				}).bind(this));
			}
github platformio / platformio-atom-ide / lib / import-arduino-project / command.js View on Github external
return new Promise((resolve, reject) => {
          temp.mkdir('pio-arduino-import', (err, dirPath) => {
            if (err) {
              reject(err);
            } else {
              fs.copy(projectPath, dirPath, {clobber: true, filter: skipVCS}, (err) => {
                if (err) {
                  reject(err);
                }
                resolve(dirPath);
              });
            }
          });
        });
      }