diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2020-04-28 17:32:59 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2020-04-28 17:32:59 -0400 |
commit | d020ab540abaf279414aa682c8930a4b280ace55 (patch) | |
tree | 2cab1b330659a97664af86e34f52d2d1b0ed49e1 /src/server/SharedMediaTypes.ts | |
parent | 4ecf08b5c5cdc4ddb3a997e2f3a2188e921ff430 (diff) | |
parent | 6b2896756c55727ed397c223187cb03fe8a51a59 (diff) |
merged with master
Diffstat (limited to 'src/server/SharedMediaTypes.ts')
-rw-r--r-- | src/server/SharedMediaTypes.ts | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/src/server/SharedMediaTypes.ts b/src/server/SharedMediaTypes.ts index 8d0f441f0..0f788f6c5 100644 --- a/src/server/SharedMediaTypes.ts +++ b/src/server/SharedMediaTypes.ts @@ -1,8 +1,51 @@ +import { ExifData } from 'exif'; +import { File } from 'formidable'; + export namespace AcceptibleMedia { export const gifs = [".gif"]; export const pngs = [".png"]; export const jpgs = [".jpg", ".jpeg"]; - export const imageFormats = [...pngs, ...jpgs, ...gifs]; + export const webps = [".webp"]; + export const tiffs = [".tiff"]; + export const imageFormats = [...pngs, ...jpgs, ...gifs, ...webps, ...tiffs]; export const videoFormats = [".mov", ".mp4"]; export const applicationFormats = [".pdf"]; + export const audioFormats = [".wav", ".mp3", ".flac", ".au", ".aiff", ".m4a", ".webm"]; +} + +export namespace Upload { + + export function isImageInformation(uploadResponse: Upload.FileInformation): uploadResponse is Upload.ImageInformation { + return "nativeWidth" in uploadResponse; + } + + export interface FileInformation { + accessPaths: AccessPathInfo; + rawText?: string; + } + + export type FileResponse<T extends FileInformation = FileInformation> = { source: File, result: T | Error }; + + export type ImageInformation = FileInformation & InspectionResults; + + export interface AccessPathInfo { + [suffix: string]: { client: string, server: string }; + } + + export interface InspectionResults { + source: string; + requestable: string; + exifData: EnrichedExifData; + contentSize: number; + contentType: string; + nativeWidth: number; + nativeHeight: number; + filename?: string; + } + + export interface EnrichedExifData { + data: ExifData; + error?: string; + } + }
\ No newline at end of file |