knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

dqmagic

Travis-CI Build Status Coverage Status

The dqmagic package provides an R interface for the libmagic file type identification library similar to the Unix file command. This allows for file type identification based on a file's content instead of it's extension.

Installation

In order to install and use dqmagic you will need the libmagic library and headers:

At the moment dqmagic is not on CRAN, but you can install the current version via drat:

if (!requireNamespace("drat", quietly = TRUE)) install.packages("drat")
drat::addRepo("daqana")
install.packages("dqmagic")

Examples

This is a basic example which shows you how to determine the type of a file:

library(dqmagic)
file_type("DESCRIPTION")
file_type("src/file.cpp")

And the same for the MIME type and encoding:

library(dqmagic)
file_type("DESCRIPTION", mime_type = TRUE, mime_encoding = TRUE)
file_type("src/file.cpp", mime_type = TRUE, mime_encoding = TRUE)


daqana/dqmagic documentation built on May 8, 2020, 3:11 a.m.