I am facing issue "Call to a member function getBody() on string" I am using following code
public function downloadFile($fileId , $name)
{
try
{
$content = $this->service->files->get($fileId, array("alt" => "media"));
$outHandle = fopen(APPPATH ."Downloads". "/" . $name , "w+");
while (!$content->getBody()->eof()) {
fwrite($outHandle, $content->getBody()->read(1024));
}
fclose($outHandle);
return $outHandle;
} catch (\Exception $e) {
}
}