@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 11 lines 563 Bytes
Raw
1 import { filePreviewKind } from "@t3tools/shared/filePreview";
2
3 export function inlineFilePreviewKind(file: { readonly name: string; readonly mimeType?: string }) {
4 return filePreviewKind(file) === "audio" ? "audio" : null;
5 }
6
7 export function isPdfFile(file: { readonly name: string; readonly mimeType?: string }): boolean {
8 const mimeType = file.mimeType?.split(";", 1)[0]?.trim().toLowerCase();
9 if (mimeType && mimeType !== "application/octet-stream") return mimeType === "application/pdf";
10 return /\.pdf$/i.test(file.name.split(/[?#]/, 1)[0] ?? "");
11 }