title: unzip or decompress data from API response in angular2
body: <p>I'm using unzip function to decompress the zipped response from API in typescript (angular2).</p>
  
  <pre><code>customers:any=[];
  zlib.gunzip(Buffer.from(response), function(err, uncompressedMessage) 
  {
    if(err) 
    {
      console.log(err);
    }
    else 
    {
      resultArray = JSON.parse(uncompressedMessage.toString());
      consloe('response After Unzip within fun',resultArray);        
      this.customers = resultArray; // error undefined
    }
  });
  console('response After Unzip outside fun',resultArray); // undefined
  </code></pre>
  
  <p>Here the resultArray is only accessible within function but not outside. I tried for declaring global variable and aceess it but not able access the value So, pls suggest me that how can I achieve this.</p>