Files
otunes/lib/audio-content-type.ts
T
joshuafhiggins Verified 76bead7449
Docker Image CI / build-and-push (push) Has been cancelled
feat: actual, honest-to-god playback
2026-06-04 22:47:22 -04:00

23 lines
555 B
TypeScript

export function audioContentTypeForPath(filePath: string): string {
const lower = filePath.toLowerCase()
if (lower.endsWith(".mp3")) {
return "audio/mpeg"
}
if (lower.endsWith(".m4a") || lower.endsWith(".mp4")) {
return "audio/mp4"
}
if (lower.endsWith(".flac")) {
return "audio/flac"
}
if (lower.endsWith(".ogg") || lower.endsWith(".opus")) {
return "audio/ogg"
}
if (lower.endsWith(".wav")) {
return "audio/wav"
}
if (lower.endsWith(".aac")) {
return "audio/aac"
}
return "application/octet-stream"
}