Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save oshliaer/a1431ddea6625b19e797497bc0465514 to your computer and use it in GitHub Desktop.
Save oshliaer/a1431ddea6625b19e797497bc0465514 to your computer and use it in GitHub Desktop.

Google Drive MimeTypes are tied with static icons

Unsplash

function getIconUrl(mimeType) {
var url = 'https://ssl.gstatic.com/images/icons/material/system/svg/';
var lib = {
'application/vnd.google-apps.script': 'drive_script_24px.svg',
'application/vnd.google-apps.site': 'drive_site_24px.svg',
'application/vnd.google-apps.folder': 'folder_24px.svg',
'application/vnd.google-apps.document': 'drive_document_24px.svg',
'application/vnd.google-apps.spreadsheet': 'drive_spreadsheet_24px.svg',
'application/vnd.google-apps.audio': 'drive_audio_24px.svg',
'application/vnd.google-apps.drawing': 'drive_drawing_24px.svg',
'application/vnd.google-apps.form': 'drive_form_24px.svg',
'application/vnd.google-apps.fusiontable': 'drive_fusiontable_24px.svg',
'application/vnd.google-apps.map': 'file_map_24px.svg',
'application/vnd.google-apps.unknown': 'unknown_1_24px.svg',
'application/vnd.google-apps.presentation': 'drive_presentation_24px.svg',
'application/vnd.google-apps.video': 'drive_video_24px.svg'
};
url += lib.hasOwnProperty(mimeType) ? lib[mimeType] : 'drive_file_24px.svg';
return url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment