Module: alfresco/core/FileIconUtils

alfresco/core/FileIconUtils

This module provides utility functions that can be used to construct file names for icons based on file names, type or parent types. The code was ported from: https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/web-framework-commons/source/web/js/alfresco.js
Author:
  • Dave Draper
License:
Source:

Members

fileIconTypes :object

A map of model type to icon type
Type:
  • object
Source:

Methods

getFileExtension(filePath) → {string}

Returns the extension from file url or path
Parameters:
Name Type Description
filePath string File path from which to extract file extension
Source:
Returns:
File extension or null
Type
string

getFileIcon(p_fileName, p_fileType, p_iconSize) → {string}

Given a filename, returns either a filetype icon or generic icon file stem
Parameters:
Name Type Description
p_fileName string File to find icon for
p_fileType string Optional: Filetype to offer further hinting
p_iconSize int Icon size: 32
Source:
Returns:
The icon name, e.g. doc-file-32.png
Type
string

getFileIconByMimetype(mimetype, p_iconSize)

Retrieves an icon file name based on the supplied MIME type.
Parameters:
Name Type Description
mimetype string The MIME type to match to an extension
p_iconSize number The size of the icon required (in pixels)
Source: