mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-19 09:20:30 +01:00
d071d18dd7
* wip * wip * fix * clean up * Update tsconfig.json * Update activitypub.ts * wip
15 lines
371 B
TypeScript
15 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();
|
|
}
|
|
}
|