class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
Guesses the mime type with the binary "file" (only available on *nix).
__construct(string $cmd = 'file -b --mime %s 2>/dev/null') The $cmd pattern must contain a "%s" string that will be replaced with the file name to guess. | ||
static bool | isSupported() Returns whether this guesser is supported on the current OS. | |
string | guess(string $path) Guesses the mime type of the file with the given path. |
The $cmd pattern must contain a "%s" string that will be replaced with the file name to guess.
The command output must start with the mime type of the file.
string | $cmd | The command to run to get the mime type of a file |
Returns whether this guesser is supported on the current OS.
bool |
Guesses the mime type of the file with the given path.
string | $path | The path to the file |
string | The mime type or NULL, if none could be guessed |
FileNotFoundException | If the file does not exist |
AccessDeniedException | If the file could not be read |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.html