Zend\Diactoros\Stream::getSize PHP Method

getSize() public method

public getSize ( )
    public function getSize()
    {
        if (null === $this->resource) {
            return null;
        }
        $stats = fstat($this->resource);
        return $stats['size'];
    }

Usage Example

Esempio n. 1
0
 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));
 }