pleroma-fe/src/services/file_type/file_type.service.js

28 lines
387 B
JavaScript
Raw Normal View History

2016-11-25 18:21:25 +01:00
const fileType = (typeString) => {
let type = 'unknown'
if (typeString.match(/text\/html/)) {
type = 'html'
}
if (typeString.match(/image/)) {
type = 'image'
}
2018-11-27 14:10:35 +01:00
if (typeString.match(/video/)) {
2016-11-25 18:21:25 +01:00
type = 'video'
}
2018-11-27 14:10:35 +01:00
if (typeString.match(/audio/)) {
2016-11-25 18:21:25 +01:00
type = 'audio'
}
return type
}
const fileTypeService = {
fileType
}
export default fileTypeService