mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-24 21:19:07 +01:00
16 lines
371 B
TypeScript
16 lines
371 B
TypeScript
import { createTemp } from "./create-temp.js";
|
|
import { downloadUrl } from "./download-url.js";
|
|
import { detectType } from "./get-file-info.js";
|
|
|
|
export async function detectUrlMime(url: string) {
|
|
const [path, cleanup] = await createTemp();
|
|
|
|
try {
|
|
await downloadUrl(url, path);
|
|
const { mime } = await detectType(path);
|
|
return mime;
|
|
} finally {
|
|
cleanup();
|
|
}
|
|
}
|