stream_get_meta_data

Supported Versions: PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8
Retrieves header/meta data from streams/file pointers
<?php stream_get_meta_data(resource $stream): array
<?php         $this->givenWeHaveAnExistingFile('path.txt');



        $resource = $adapter->readStream('path.txt');

        $metadata = stream_get_meta_data($resource);

        fclose($resource);



        $this->assertTrue($metadata['seekable']);
<?php         $this->givenWeHaveAnExistingFile('path.txt');



        $resource = $adapter->readStream('path.txt');

        $metadata = stream_get_meta_data($resource);

        fclose($resource);



        $this->assertEquals($seekable, $metadata['seekable']);
<?php         $this->givenWeHaveAnExistingFile('path.txt');



        $resource = $adapter->readStream('path.txt');

        $metadata = stream_get_meta_data($resource);

        fclose($resource);



        $this->assertTrue($metadata['seekable']);
<?php     private function rewindStream($resource): void

    {

        if (ftell($resource) !== 0 && stream_get_meta_data($resource)['seekable']) {

            rewind($resource);

        }

    }