Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function loadTests(tag) {
let filename = 'testcases/' + tag + ".json.gz";
if (Cache[filename] == null) {
console.log("loading:", filename);
Cache[filename] = JSON.parse(zlib.gunzipSync(new Buffer(data[filename], "base64")).toString());
}
return Cache[filename];
}
export function loadData(filename) {
export function loadTests(tag) {
let filename = path.resolve(__dirname, '../testcases', tag + '.json.gz');
return JSON.parse(zlib.gunzipSync(fs.readFileSync(filename)).toString());
}
export function loadData(filename) {
export function loadTests(tag: string): any {
let filename = path.resolve(__dirname, '../testcases', tag + '.json.gz');
return JSON.parse(zlib.gunzipSync(fs.readFileSync(filename)).toString());
}
export var decode = (encoded:string) : Object[] => {
var decoded = new Buffer(encoded, 'base64');
var uncompressedBuffer :Buffer;
try {
uncompressedBuffer = zlib.gunzipSync(decoded);
} catch (e) {
log.debug('gzip failed, assuming uncompressed messages');
uncompressedBuffer = decoded;
}
var json = uncompressedBuffer.toString();
return JSON.parse(json);
};