get_content_type {wand}R Documentation

Discover MIME type of a file based on contents

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. File an issue or PR if more magic-byte-level comparisons are required/desired. If no match is found, ??? is returned.

Usage

get_content_type(path)

Arguments

path

path to a file

Details

Initial in-R header mapping logic borrowed from MimeTypes.java from servoy-client

Value

character vector

Examples

get_content_type(system.file("extdat", "test.pdf", package="wand"))

[Package wand version 0.5.0 Index]