MCPcopy Create free account
hub / github.com/apitable/apitable / isDocType

Function isDocType

packages/datasheet/src/pc/utils/file_type.ts:127–139  ·  view source on GitHub ↗
(file: IFileLikeProps)

Source from the content-addressed store, hash-verified

125}
126
127export function isDocType(file: IFileLikeProps) {
128 const inferredType = mime.lookup(file.name) as string;
129 if (accept(file, WORD_MIME_TYPE) || WORD_MIME_TYPE.includes(inferredType)) {
130 return DocType.Word;
131 }
132 if (accept(file, PPT_MIME_TYPE) || PPT_MIME_TYPE.includes(inferredType)) {
133 return DocType.PPT;
134 }
135 if (accept(file, EXCEL_MIME_TYPE) || EXCEL_MIME_TYPE.includes(inferredType)) {
136 return DocType.Excel;
137 }
138 return '';
139}
140
141export function renderFileIconUrl(curFile: IFileLikeProps) {
142 const type = isWhatFileType({ name: curFile.name, type: curFile.type });

Callers 1

renderFileIconUrlFunction · 0.70

Calls 1

lookupMethod · 0.65

Tested by

no test coverage detected