Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
boB Rudis 1f89bed4a5
NEWS
il y a 5 ans
.vscode Added better jpeg + new lzip, 7-zip, wasm, pcap, avro, parquet detections il y a 6 ans
R Addresses #4 il y a 5 ans
inst Addresses #4 il y a 5 ans
man Addresses #4 il y a 5 ans
tests cran il y a 5 ans
tools new built-in MIME types and improvements enabling alternate db il y a 5 ans
.Rbuildignore sourcehut build test il y a 5 ans
.build.yml new srht build il y a 5 ans
.gitignore initial commit il y a 8 ans
.travis.yml cran il y a 5 ans
CRAN-RELEASE NEWS il y a 5 ans
DESCRIPTION length 1 il y a 5 ans
LICENSE cran il y a 5 ans
NAMESPACE new built-in MIME types and improvements enabling alternate db il y a 5 ans
NEWS.md NEWS il y a 5 ans
README.Rmd README il y a 5 ans
README.md README il y a 5 ans
appveyor.yml badges il y a 5 ans
cran-comments.md NEWS il y a 5 ans
wand.Rproj pkg rename il y a 8 ans

README.md

Project Status: Active – The project has reached a stable, usablestate and is being activelydeveloped. Signedby Signed commit% Linux buildStatus builds.sr.htstatus Windows buildstatus CoverageStatus cranchecks CRANstatus Minimal RVersion License

wand

Retrieve Magic Attributes from Files and Directories

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,800 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 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:

  • get_content_type: Discover MIME type of a file based on contents
  • guess_content_type: Guess MIME type from filename (extension)
  • simplemagic_mime_db: File extension-to-MIME mapping data frame

Installation

install.packages("wand", repos = "https://cinc.rud.is")
# or
remotes::install_git("https://git.rud.is/hrbrmstr/wand.git")
# or
remotes::install_git("https://git.sr.ht/~hrbrmstr/wand")
# or
remotes::install_gitlab("hrbrmstr/wand")
# or
remotes::install_bitbucket("hrbrmstr/wand")
# or
remotes::install_github("hrbrmstr/wand")

NOTE: To use the ‘remotes’ install options you will need to have the {remotes} package installed.

Usage

library(wand)
library(tidyverse)

# current verison
packageVersion("wand")
## [1] '0.6.0'
list.files(system.file("extdat", "pass-through", package="wand"), full.names=TRUE) %>% 
  map_df(~{
    tibble(
      fil = basename(.x),
      mime = list(get_content_type(.x))
    )
  }) %>% 
  unnest()
## # A tibble: 85 x 2
##    fil                        mime                                                             
##    <chr>                      <chr>                                                            
##  1 actions.csv                application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
##  2 actions.txt                application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
##  3 actions.xlsx               application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
##  4 test_128_44_jstereo.mp3    audio/mp3                                                        
##  5 test_excel_2000.xls        application/msword                                               
##  6 test_excel_spreadsheet.xml application/xml                                                  
##  7 test_excel_web_archive.mht message/rfc822                                                   
##  8 test_excel.xlsm            application/zip                                                  
##  9 test_excel.xlsx            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
## 10 test_nocompress.tif        image/tiff                                                       
## # … with 75 more rows

wand Metrics

Lang # Files (%) LoC (%) Blank lines (%) # Lines (%)
R 7 0.78 159 0.62 62 0.78 72 0.71
JSON 1 0.11 80 0.31 0 0.00 0 0.00
Rmd 1 0.11 17 0.07 17 0.22 29 0.29

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.