I have a resource variable $resource holding stream of .gz file. If i write it down as a file by
$resource
file_put_contents(\'experiment.gz\', $resource);