Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
https.get(url, function(result) {
var targetPath = path.join(testDir, targetName);
var out = fs.createWriteStream(targetPath);
result.on('data', function(data) {
out.write(data);
});
result.on('end', function() {
out.end();
out.destroySoon();
});
out.on('close', resolve);
}).on('error', function(err) {
console.error(err);