Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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));
});
};
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) {
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() {
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);
}
});
});
}
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) {
beforeEach((done) => {
temp.mkdir("akiroBuilder", (error, newTemporaryDirectoryPath) => {
temporaryDirectoryPath = newTemporaryDirectoryPath;
done();
});
});
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);
});
});
};
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){
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));
}
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);
});
}
});
});
}