filecache

This commit is contained in:
cansnow
2025-12-27 07:08:30 +08:00
parent 974d149d25
commit 09c7889525
54 changed files with 10485 additions and 164 deletions
@@ -0,0 +1,17 @@
export function lookupExt(contentType: string): string | undefined {
const rawContentType = contentType.split(';')[0].trim().toLowerCase()
return (UTSHarmony.getExtensionFromMimeType(rawContentType) as string | null) || undefined
}
export function lookupContentTypeWithUri(uri: string): string | undefined {
const uriArr = uri.split('.')
if (uriArr.length <= 1) {
return undefined
}
const ext = uriArr.pop() as string
return (UTSHarmony.getMimeTypeFromExtension(ext) as string | null) || undefined
}
export function lookupContentType(ext: string): string | undefined {
return (UTSHarmony.getMimeTypeFromExtension(ext) as string | null) || undefined
}