Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
zlib.gzip(nbtData, function(err, data) {
if (err) {
let error = new Error('Error while creating map file');
error.http_code = 500;
error.zlib_error = err;
throw error;
}
let writeStream = new lazystream.Writable(function () {
return fs.createWriteStream(`${TMP_DIR}${filename}.dat`)
.on('close', function () {
winston.log('info', `Map file written to disk: ${filename}.dat`);
res.setHeader('Content-Type', 'text/html');
res.writeHead(200);
res.end(filename);
});
});
writeStream.write(data);
writeStream.end();
});
} catch (e) {