get_content_type: Discover MIME type of a file based on contents

Description Usage Arguments Details Value Examples

View source: R/get-content-type.R

Description

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.

Usage

1
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

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).

Value

character vector

Examples

1
get_content_type(system.file("extdat", "pass-through", "test.pdf", package="wand"))

hrbrmstr/wand documentation built on Sept. 28, 2019, 6:05 a.m.