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.
boB Rudis 3b8cb8b51f
sourcehut build test
4 years ago
.vscode Added better jpeg + new lzip, 7-zip, wasm, pcap, avro, parquet detections 5 years ago
R length 1 4 years ago
inst new built-in MIME types and improvements enabling alternate db 4 years ago
man parameter docs 4 years ago
tests cran 4 years ago
tools new built-in MIME types and improvements enabling alternate db 4 years ago
.Rbuildignore sourcehut build test 4 years ago
.build.yml sourcehut build test 4 years ago
.gitignore initial commit 7 years ago
.travis.yml cran 4 years ago
DESCRIPTION length 1 4 years ago
LICENSE cran 4 years ago
NAMESPACE new built-in MIME types and improvements enabling alternate db 4 years ago NEWS 4 years ago
README.Rmd sourcehut build test 4 years ago new built-in MIME types and improvements enabling alternate db 4 years ago
appveyor.yml badges 4 years ago NEWS 4 years ago
wand.Rproj pkg rename 7 years ago

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


Retrieve Magic Attributes from Files and Directories


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.


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 that you would like mapped.

What’s Inside The Tin

  • 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

The following functions are implemented:


install.packages("wand", repos = "")
# or
# or
# or
# or
# or

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



# current verison
## [1] '0.6.0'
list.files(system.file("extdat", package="wand"), full.names=TRUE) %>% 
      fil = basename(.x),
      mime = list(get_content_type(.x))
  }) %>% 
fil mime
actions.csv application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
actions.txt application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
actions.xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
test_128_44_jstereo.mp3 audio/mp3
test_excel_2000.xls application/msword
test_excel_spreadsheet.xml application/xml
test_excel_web_archive.mht message/rfc822
test_excel.xlsm application/zip
test_excel.xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
test_nocompress.tif image/tiff
test_powerpoint.pptm application/zip
test_powerpoint.pptx application/vnd.openxmlformats-officedocument.presentationml.presentation
test_word_2000.doc application/msword
test_word_6.0_95.doc application/msword
test_word.docm application/zip
test_word.docx application/vnd.openxmlformats-officedocument.wordprocessingml.document audio/basic
test.bin application/mac-binary
test.bin application/macbinary
test.bin application/octet-stream
test.bin application/x-binary
test.bin application/x-macbinary
test.bmp image/bmp
test.dtd application/xml-dtd
test.emf application/x-msmetafile
test.emf image/emf
test.eps application/postscript
test.fli video/flc
test.fli video/fli
test.fli video/x-fli
test.gif image/gif
test.ico image/
test.ico image/x-icon
test.jpg image/jpeg
test.mp3 audio/mp3
test.odt application/vnd.oasis.opendocument.text
test.ogg application/ogg
test.ogg audio/ogg
test.pcx image/pcx
test.pcx image/vnd.zbrush.pcx
test.pcx image/x-pcx
test.pdf application/pdf application/x-perl text/plain text/x-perl text/x-script.perl
test.png image/png
test.pnm application/x-portable-anymap
test.pnm image/x-portable-anymap
test.ppm image/x-portable-pixmap
test.ppt application/msword application/postscript
test.psd image/photoshop text/x-python text/x-script.phyton
test.rtf application/rtf
test.rtf application/x-rtf
test.rtf text/richtext
test.rtf text/rtf application/x-bsh application/x-sh application/x-shar text/ text/x-sh
test.tar application/tar
test.tar.gz application/gzip
test.tar.gz application/octet-stream
test.tar.gz application/x-compressed
test.tar.gz application/x-gzip
test.tga image/x-tga
test.txt text/plain
test.txt.gz application/gzip
test.txt.gz application/octet-stream
test.txt.gz application/x-compressed
test.txt.gz application/x-gzip
test.wav audio/x-wav
test.wmf application/x-msmetafile
test.wmf image/wmf
test.wmf windows/metafile
test.xcf application/x-xcf
test.xml application/xml
test.xpm image/x-xbitmap
test.xpm image/x-xpixmap
test.xpm image/xpm application/zip

cloc Metrics

Lang # Files (%) LoC (%) Blank lines (%) # Lines (%)
R 7 0.78 154 0.61 59 0.78 70 0.69
JSON 1 0.11 80 0.32 0 0.00 0 0.00
Rmd 1 0.11 17 0.07 17 0.22 31 0.31

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.