ancarda / file-detector

MIME type detector for partial file streams of unlimited length

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ancarda/file-detector

MIME type detector for partial file streams of unlimited length

Latest Stable Version Total Downloads License Build Status Coverage Status

file-detector is a library for PHP 7.0+ that accepts a file stream of any length, even if it's a partial file type, and provides a MIME detector for it.

The detector class can be used with any framework and has no dependencies. This library may be installed via composer with the following command:

composer require ancarda/file-detector

The detector can then be initalized and used, like so. For example:

<?php

$resource = fopen('example.jpg', 'r');
$detector = new \Ancarda\File\Detector;
$mimetype = $detector->determineMimeType($resource);

//$mimetype is now 'image/jpg'

About

MIME type detector for partial file streams of unlimited length

License:MIT License


Languages

Language:PHP 100.0%