From 9703ba53405b2f355c6e0317f714d82ff3d4dee3 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Sun, 12 Jan 2020 16:40:58 +0900 Subject: ファイルと画像認識処理の改善 (#5690) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * dimensions制限とリファクタ * comment * 不要な変更削除 * use fromFile など * Add probe-image-size.d.ts * えーCRLFで作るなよ… * Update src/@types/probe-image-size.d.ts Co-Authored-By: Acid Chicken (硫酸鶏) * fix d.ts * Update src/@types/probe-image-size.d.ts Co-Authored-By: Acid Chicken (硫酸鶏) * Update src/@types/probe-image-size.d.ts Co-Authored-By: Acid Chicken (硫酸鶏) * fix Co-authored-by: Acid Chicken (硫酸鶏) --- src/@types/probe-image-size.d.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/@types/probe-image-size.d.ts (limited to 'src/@types') diff --git a/src/@types/probe-image-size.d.ts b/src/@types/probe-image-size.d.ts new file mode 100644 index 0000000000..665edcf2e7 --- /dev/null +++ b/src/@types/probe-image-size.d.ts @@ -0,0 +1,27 @@ +declare module 'probe-image-size' { + import { ReadStream } from 'fs'; + + type ProbeOptions = { + retries: 1; + timeout: 30000; + }; + + type ProbeResult = { + width: number; + height: number; + length?: number; + type: string; + mime: string; + wUnits: 'in' | 'mm' | 'cm' | 'pt' | 'pc' | 'px' | 'em' | 'ex'; + hUnits: 'in' | 'mm' | 'cm' | 'pt' | 'pc' | 'px' | 'em' | 'ex'; + url?: string; + }; + + function probeImageSize(src: string | ReadStream, options?: ProbeOptions): Promise; + function probeImageSize(src: string | ReadStream, callback: (err: Error | null, result?: ProbeResult) => void): void; + function probeImageSize(src: string | ReadStream, options: ProbeOptions, callback: (err: Error | null, result?: ProbeResult) => void): void; + + namespace probeImageSize {} // Hack + + export = probeImageSize; +} -- cgit v1.2.3-freya