summaryrefslogtreecommitdiff
path: root/src/misc/detect-url-mine.ts
blob: eef64cfc564f45adfc9e48e819ff04c7fbc0653b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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();
	}
}