1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-26 04:28:17 +09:00
MisskeyIO/src/misc/detect-url-mine.ts

16 lines
358 B
TypeScript
Raw Normal View History

import { createTemp } from './create-temp';
import { downloadUrl } from './donwload-url';
import { detectMine } from './detect-mine';
export async function detectUrlMine(url: string) {
const [path, cleanup] = await createTemp();
try {
await downloadUrl(url, path);
const [type] = await detectMine(path);
return type;
} finally {
cleanup();
}
}