You are viewing documentation for an outdated version. It is no longer supported!

MIME-Type

The mimeType() method can be used to determine the file stream's MIME-Typeopen in new window.

$stream = FileStream::open('houses.txt', 'rb');

echo $stream->mimeType(); // text/plain

Behind the scene, the MIME-Type Component is used.

Profile and Options

The method also allows you to specify what "profile" to use for determining the MIME-Type, as well as eventual options for the profile.

$stream = FileStream::open('houses.txt', 'rb');

echo $stream->mimeType('mime-detector-profile', [
    'sample_size' => 50
]); // text/plain

Please see MIME-Type usage for additional details.