You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

2.0 KiB

---
output:
rmarkdown::github_document:
df_print: kable
---
```{r pkg-knitr-opts, include=FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
fig.retina = 1,
message = FALSE,
warning = FALSE,
fig.path = "man/figures/README-"
)
options(width=120)
```

```{r badges, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::stinking_badges()
```

# wand

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 curated "magic" tests as well as mapping 'MIME' types from a database of over 1,500 extension mappings.

## 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`](https://github.com/threatstack/libmagic/tree/master/magic/) 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

```{r ingredients, results='asis', echo=FALSE}
hrbrpkghelpr::describe_ingredients()
```

The following functions are implemented:

## Installation

```{r install-ex, results='asis', echo = FALSE}
hrbrpkghelpr::install_block()
```

## Usage

```{r vers, message=FALSE, warning=FALSE, error=FALSE}
library(wand)
library(tidyverse)

# current verison
packageVersion("wand")
```

```{r ex1}
list.files(system.file("extdat", package="wand"), full.names=TRUE) %>%
map_df(~{
tibble(
fil = basename(.x),
mime = list(get_content_type(.x))
)
}) %>%
unnest()
```

## cloc Metrics

```{r cloc, echo=FALSE}
cloc::cloc_pkg_md()
```

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