Project Status: Active - The project has reached a stable, usable state and is being actively developed. Travis-CIBuild Status AppVeyor Build Status Coverage Status

simplemagic

Lightweight File 'MIME' Type Detection Based On Contents or Extension

Description

'MIME' types are shorthand descriptors for file contents and can be determined from "magic" bytes in file headers, file contents or intuited from file extensions. Tools are provided to perform limited "magic" tests as well as mapping 'MIME' types from a database of over 1,500 extension mappings.

Provides a more portable/ligtweight alternative to the wand package.

SOME IMPORTANT DETAILS

The header checking is minimal (i.e. nowhere near as comprehensive as libmagic) but covers quite a bit of ground. If there are content-check types from magic sources that you would like coded into the package, please file an issue and include the full line(s) from that linked magic.tab that you would like mapped.

What's Inside The Tin

The following functions are implemented:

Installation

devtools::install_github("hrbrmstr/simplemagic")
options(width=120)

Usage

library(simplemagic)
library(tidyverse)

# current verison
packageVersion("simplemagic")
list.files(system.file("extdat", package="simplemagic"), full.names=TRUE) %>% 
  map_df(~{
    data_frame(
      fil = basename(.x),
      mime = list(get_content_type(.x))
    )
  }) %>% 
  unnest() %>% 
  print(n=100)

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.



hrbrmstr/simplemagic documentation built on July 22, 2019, 8:05 a.m.