I'm fairly new to JavaScript. I'm currently working on an algorithm that deflates in Java and inflates in javascript. For the most part, I have heard that pako.js is a good tool to use for decompression but I'm having problems implementing it. I created a function in JavaScript that passes the base64 string as a parameter.
function decompressHtml(html){
var compressedData = atob(html);
var charData = compressedData.split('').map(function(x){return x.charCodeAt(0);});
var binData = new Uint8Array(charData);
var inflated = '';
try {
inflated = pako.inflate(binData);
} catch (err) {
console.log(err);
}
return inflated;
}
It always returns an error that says that pako is not properly defined. Is there a specific script tag/s that need to be inserted in order to define pako? I realise this may be a simple question to answer but I'm not sure of the answer.