public function getEncoding(LocalFileNodeInterface $file)
    {
        $cmd = "file --brief --uncompress --mime {$file->getPath()}";

        $process = $this->getProcess($cmd);
        $process->mustRun();

        $result = $process->getOutput();
        if (preg_match('/charset=([^\s]+)/i', $result, $matches)) {
            $this->log(LogLevel::DEBUG, "Found the encoding for '{file}' as '{encoding}'", [
                'file'     => $file,
                'encoding' => $matches[1],
            ]);
            return $matches[1];
        }
        return null;
    }