drive_mime_type: Lookup MIME type

Description Usage Arguments Value Examples

View source: R/drive_mime_type.R

Description

This is a helper to determine which MIME type should be used for a file. Three types of input are acceptable:

Usage

1

Arguments

type

Character. Google Drive file type, file extension, or MIME type. Pass the sentinel expose() if you want to get the full table used for validation and lookup, i.e. all MIME types known to be relevant to the Drive API.

Value

Character. MIME type.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## get the mime type for Google Spreadsheets
drive_mime_type("spreadsheet")

## get the mime type for jpegs
drive_mime_type("jpeg")

## it's vectorized
drive_mime_type(c("presentation", "pdf", "image/gif"))

## see the internal tibble of MIME types known to the Drive API
drive_mime_type(expose())

Example output

[1] "application/vnd.google-apps.spreadsheet"
[1] "image/jpeg"
[1] "application/vnd.google-apps.presentation"
[2] "application/pdf"                         
[3] "image/gif"                               
# A tibble: 77 x 4
                                                                 mime_type
                                                                     <chr>
 1                       application/x-vnd.oasis.opendocument.presentation
 2                                               text/tab-separated-values
 3                                                              image/jpeg
 4                                                              image/jpeg
 5                                                              image/jpeg
 6                                                               image/bmp
 7                                                               image/gif
 8                          application/vnd.ms-excel.sheet.macroenabled.12
 9 application/vnd.openxmlformats-officedocument.wordprocessingml.template
10              application/vnd.ms-powerpoint.presentation.macroenabled.12
# ... with 67 more rows, and 3 more variables: ext <chr>, human_type <chr>,
#   default <lgl>

googledrive documentation built on July 8, 2021, 5:07 p.m.