public function getSize()
{
if (null === $this->resource) {
return null;
}
$stats = fstat($this->resource);
return $stats['size'];
}
protected function generateBinaryResponse($path, $extraHeaders = []) { $body = new Stream($path); return new Response($body, 200, ArrayUtils::merge(['Content-Type' => (new \finfo(FILEINFO_MIME))->file($path), 'Content-Length' => (string) $body->getSize()], $extraHeaders)); }