* Refactor download

* emoji type
This commit is contained in:
MeiMei 2019-03-21 04:50:44 +09:00 committed by syuilo
parent 1c79e30436
commit 7bebea087c
12 changed files with 151 additions and 237 deletions

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