Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return through.obj(function (file, encoding, callback) {
if (file.isNull()) {
// nothing to do
return callback(null, file);
}
if (file.isStream()) {
// file.contents is a Stream - https://nodejs.org/api/stream.html
this.emit('error', new PluginError(PLUGIN_NAME, 'Streams not supported!'));
} else if (file.isBuffer()) {
// file.contents is a Buffer - https://nodejs.org/api/buffer.html
var doc = scratchblocks.parse(file.contents.toString())
doc.render(svg => {
var string = doc.exportSVGString();
// Remove invalid xmlns attribute due to issue https://github.com/scratchblocks/scratchblocks/issues/219
string = string.replace(
/