getFileContentType

open suspend override fun getFileContentType(path: Path): FileMetadata.FileContentType(source)

Detects the type of content stored in a file using a path.

The operation is performed with Dispatchers.IO context.

Return

FileContentType.Text for text files, FileContentType.Binary for binary files.

Parameters

path

The path to the file whose content type is to be detected.

Throws

if the path doesn't exist or isn't a regular file.

if an I/O error occurs while detecting the file content type.