public function getFileMimeType($filename, $service)
    {
        $binary = '/usr/bin/file';
        $mime_type = $this->exec(
            "if [ -e {$binary} ]; then {$binary} -b --mime-type {$filename}; fi",
            $service,
            [],
            true
        );

        if (empty($mime_type)) {
            throw new \Exception(
                sprintf('No mime type was captured for %s.', $filename)
            );
        }

        return $mime_type;
    }