mirror of
https://github.com/misskey-dev/misskey
synced 2024-12-20 01:29:02 +09:00
9703ba5340
* dimensions制限とリファクタ * comment * 不要な変更削除 * use fromFile など * Add probe-image-size.d.ts * えーCRLFで作るなよ… * Update src/@types/probe-image-size.d.ts Co-Authored-By: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * fix d.ts * Update src/@types/probe-image-size.d.ts Co-Authored-By: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * Update src/@types/probe-image-size.d.ts Co-Authored-By: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * fix Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
16 lines
362 B
TypeScript
16 lines
362 B
TypeScript
import { createTemp } from './create-temp';
|
|
import { downloadUrl } from './donwload-url';
|
|
import { detectType } from './get-file-info';
|
|
|
|
export async function detectUrlMime(url: string) {
|
|
const [path, cleanup] = await createTemp();
|
|
|
|
try {
|
|
await downloadUrl(url, path);
|
|
const { mime } = await detectType(path);
|
|
return mime;
|
|
} finally {
|
|
cleanup();
|
|
}
|
|
}
|