There are a limited number of header "magic" bytes checked directly by this function but cover quite a bit of ground. After that, guess_content_type() is called which uses file extension-to-MIME mappings.

get_content_type(path, guess = TRUE, ...)

Arguments

path

path to a file

guess

if TRUE (the default), calls guess_content_type() if no internal rules match the magic header

...

passed on to guess_content_type() if guess is TRUE

Value

character vector

Details

File an issue or PR if more magic-byte-level comparisons are required/desired. If no match is found, ??? is returned (see guess_content_type() for how to override this behaviour).

Examples

# NOT RUN {
get_content_type(system.file("extdat", "pass-through", "test.pdf", package="wand"))
# }