Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fs.readFile(__dirname + "/shield.svg", function(err, contents){
if (err){
return cb(err);
}
contents = contents.toString();
var svgFileName = tempdir + '/' + getUniqueId(vendorText, statusText, color, 1) + '.svg';
// scale value is irrelevant for svg, so just set it to a constant 1
logger.debug("contents: ", contents);
logger.debug("svg file: ", svgFileName);
var svgFileStream = fs.createWriteStream(svgFileName);
contents.split('||').forEach(function(piece){
switch(piece){
case 'vendor' :
piece = vendorText;
break;
case 'status' :
piece = statusText;
break;
case 'color' :
piece = color;
break;
}
svgFileStream.write(piece);
});
fs.readFile(__dirname + "/shield.svg", function(err, contents){
if (err){
return cb(err);
}
contents = contents.toString();
var svgFileName = tempdir + '/' + getUniqueId(vendorText, statusText, color, 1) + '.svg';
// scale value is irrelevant for svg, so just set it to a constant 1
logger.debug("contents: ", contents);
logger.debug("svg file: ", svgFileName);
var svgFileStream = fs.createWriteStream(svgFileName);
contents.split('||').forEach(function(piece){
switch(piece){
case 'vendor' :
piece = vendorText;
break;
case 'status' :
piece = statusText;
break;
case 'color' :
piece = color;
break;
}
svgFileStream.write(piece);
});
svgFileStream.end();