FileBinaryMimeTypeGuesser
in package
implements
MimeTypeGuesserInterface
Guesses the MIME type with the binary "file" (only available on *nix).
Tags
Interfaces, Classes, Traits and Enums
- MimeTypeGuesserInterface
- Guesses the MIME type of a file.
Table of Contents
- $cmd : mixed
- __construct() : mixed
- The $cmd pattern must contain a "%s" string that will be replaced with the file name to guess.
- guessMimeType() : string|null
- Guesses the MIME type of the file with the given path.
- isGuesserSupported() : bool
- Returns true if this guesser is supported.
Properties
$cmd
private
mixed
$cmd
Methods
__construct()
The $cmd pattern must contain a "%s" string that will be replaced with the file name to guess.
public
__construct([string $cmd = 'file -b --mime -- %s 2>/dev/null' ]) : mixed
The command output must start with the MIME type of the file.
Parameters
- $cmd : string = 'file -b --mime -- %s 2>/dev/null'
-
The command to run to get the MIME type of a file
Return values
mixed —guessMimeType()
Guesses the MIME type of the file with the given path.
public
guessMimeType(string $path) : string|null
Parameters
- $path : string
-
The path to the file
Return values
string|null —The MIME type or null, if none could be guessed
isGuesserSupported()
Returns true if this guesser is supported.
public
isGuesserSupported() : bool