mirror of
https://github.com/misskey-dev/misskey
synced 2024-12-24 03:28:43 +09:00
b9cb6d1c10
将来ESMに移行しやすいように Related: #7658 なんかmochaが起動しなくなってるけど理由不明 すぐ直したい
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();
|
|
}
|
|
}
|