iceshrimp-legacy/src/misc/detect-url-mine.ts
MeiMei 7bebea087c Fix #4546 (#4548)
* Refactor download

* emoji type
2019-03-21 04:50:44 +09:00

16 lines
358 B
TypeScript

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();
}
}