FileFormat getFileFormat(string filepath, string additExt)

The function gets the FileFormat structure with info about file format.

Parameters

filepath

Path to required file.

additExt

File extension as hint for recognition algorithm. Not needed in most cases. Can be used if for some reason the file name does not have an extension.

Returns

a FileFormat object containing some format information.

FileFormat getFileFormat(string filepath)

The function gets the FileFormat structure with info about file format.

Parameters

filepath

Path to required file.

Returns

a FileFormat object containing some format information.

bool isUnicodeTextFile(string filepath) nothrow

The function returns true if specified file contains plain Unicode-text.

auto contentTypeGuess(alias useEnglish = true)(string filepath)

Returns tuple with MIME type and its description.

void addNewPathToFindFileFormats(string dir)

The functions allows to extend paths to find JSON files with file formats.

Parameters

dir

Directory to search for JSON files.

FileFormat[] getAllFileFormats()

Returns array of supported file formats.

The module implements recognition of file formats.

Main function of this module: FileFormat getFileFormat(string filepath) Recognition is carried out according to a complex algorithm based on a special file containing information about file formats. The default path of such file for a normal library installation is: /etc/amalthea-${DC}/fileformats.json You can expand the search paths for format descriptions with: void addNewPathToFindFileFormats(string dir)