mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-14 08:33:09 +02:00
15 lines
362 B
TypeScript
15 lines
362 B
TypeScript
import { createTemp } from './create-temp';
|
|
import { downloadUrl } from './download-url';
|
|
import { detectType } from './get-file-info';
|
|
|
|
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();
|
|
}
|
|
}
|