parent
1c79e30436
commit
7bebea087c
12 changed files with 151 additions and 237 deletions
15
src/misc/detect-url-mine.ts
Normal file
15
src/misc/detect-url-mine.ts
Normal file
|
@ -0,0 +1,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();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue