Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve) => {
var dir = fsTemp.template('t2-sdk-%s').mkdirSync();
resolve({
path: dir,
cleanup: () => {
try {
fs.removeSync(dir);
} catch (e) {
// If the folder no longer exists, or if the remove operation throws
// some error, this is non-fatal to the user (the data will just
// exist until the temp folder is cleaned) and so we swallow any
// errors.
}
}
});
});
}
destination: function(req, f, cb) {
temp.template('testforme-%s').mkdir(function(err, uploadDir) {
if (err) {
return cb(err, '')
}
cleanup.push(uploadDir)
cb(null, uploadDir)
})
},
filename: generateFilename,
destination: function (req, file, cb) {
temp.template('testforme-%s').mkdir(function (err, uploadDir) {
if (err) return cb(err)
cleanup.push(uploadDir)
cb(null, uploadDir)
})
},
filename: generateFilename
'use strict'
const fs = require('fs')
const temp = require('fs-temp').template('%s.png')
const looksSame = require('looks-same')
const spawnSync = require('child_process').spawnSync
const captureWindow = require('capture-window')
const sizeOf = require('image-size')
const hdiutil = require('../../lib/hdiutil')
const toleranceOpts = { tolerance: 20 }
function retry (fn, cb) {
let triesLeft = 8
function runIteration () {
fn(function (err) {
if (!err) return cb(null)
if (--triesLeft === 0) return cb(err)
destination: (req, file, cb) => {
temp.template('testforme-%s').mkdir((err, uploadDir) => {
if (err) return cb(err);
cleanup.push(uploadDir);
cb(null, uploadDir);
});
},
filename: generateFilename
before(function () {
path = temp.template('∞ %s').writeFileSync('')
})
exports.create = function (volname, size, cb) {
temp.template('%s.dmg').writeFile('', function (err, outname) {
if (err) return cb(err)
const args = [
'create', outname,
'-ov',
'-fs', 'HFS+',
'-size', size,
'-volname', volname
]
util.sh('hdiutil', args, function (err) {
if (!err) return cb(null, outname)
fs.unlink(outname, () => cb(err))
})
})