FileAccess Orion

FileBinaryMimeTypeGuesser
in package
implements MimeTypeGuesserInterface

Guesses the mime type with the binary "file" (only available on *nix).

Tags
author

Bernhard Schussek bschussek@gmail.com

deprecated

since Symfony 4.3, use instead

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.
guess()  : string|null
Guesses the mime type of the file with the given path.
isSupported()  : bool
Returns whether this guesser is supported on the current OS.

Properties

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

guess()

Guesses the mime type of the file with the given path.

public guess(mixed $path) : string|null
Parameters
$path : mixed

The path to the file

Return values
string|null

The mime type or NULL, if none could be guessed

isSupported()

Returns whether this guesser is supported on the current OS.

public static isSupported() : bool
Return values
bool

Search results