mime_type | R Documentation |
If the mime package is installed, call mime::guess_type()
, otherwise
use the system command file --mime-type
to obtain the MIME type of a file.
Typically, the file
command exists on *nix. On Windows, the command should
exist if Cygwin or Rtools is installed. If it is not found, .NET's
MimeMapping
class will be used instead (which requires the .NET framework).
mime_type(x, use_mime = loadable("mime"), empty = "text/plain")
x |
A vector of file paths. |
use_mime |
Whether to use the mime package. |
empty |
The MIME type for files without extensions (e.g., |
A character vector of MIME types.
When querying the MIME type via the system command, the result will be
cached to xfun:::cache_dir()
. This will make future queries much faster,
since running the command in real time can be a little slow.
f = list.files(R.home("doc"), full.names = TRUE)
mime_type(f)
mime_type(f, FALSE) # don't use mime
mime_type(f, FALSE, NA) # run command for files without extension
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.