amalthea.fileformats

This file is part of the Amalthea library. Copyright (C) 2019-2024 Eugene 'Vindex' Stulin Distributed under the BSL 1.0 or (at your option) the GNU LGPL 3.0 or later.

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)

Members

Functions

addNewPathToFindFileFormats
void addNewPathToFindFileFormats(string dir)

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

contentTypeGuess
auto contentTypeGuess(string filepath)

Returns tuple with MIME type and its description.

g_content_type_get_description
char* g_content_type_get_description(char* type)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
g_content_type_get_mime_type
char* g_content_type_get_mime_type(char* type)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
getAllFileFormats
FileFormat[] getAllFileFormats()

Returns array of supported file formats.

getFileFormat
FileFormat getFileFormat(string filepath, string additExt)

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

getFileFormat
FileFormat getFileFormat(string filepath)

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

isUnicodeTextFile
bool isUnicodeTextFile(string filepath)

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

Static functions

g_content_type_guess
char* g_content_type_guess(char* filename, byte* data, size_t data_size, bool* result_uncertain)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
g_free
void g_free(void* mem)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
searchBySignature
FileFormat[] searchBySignature(FileFormat[] candidates, ubyte[] data)
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

FileFormat
struct FileFormat

File format info.

Signature
struct Signature
Undocumented in source.

Variables

canonBase
string canonBase;
Undocumented in source.

Meta