UNPKG

alinea

Version:

[![npm](https://img.shields.io/npm/v/alinea.svg)](https://npmjs.org/package/alinea) [![install size](https://packagephobia.com/badge?p=alinea)](https://packagephobia.com/result?p=alinea)

46 lines (45 loc) 1.07 kB
import { Media } from 'alinea/backend/Media'; import { Connection, EntryRow } from 'alinea/core'; export declare enum UploadStatus { Queued = 0, CreatingPreview = 1, Uploading = 2, Uploaded = 3, Done = 4 } export interface UploadDestination { entryId?: string; parentId?: string; workspace: string; root: string; directory: string; } export interface Upload { id: string; file: File; to: UploadDestination; status: UploadStatus; info?: Connection.UploadResponse; preview?: string; averageColor?: string; focus?: { x: number; y: number; }; thumbHash?: string; width?: number; height?: number; result?: Media.File; error?: Error; replace?: { entry: EntryRow; entryFile: string; }; } export declare function useUploads(onSelect?: (entry: EntryRow) => void): { upload: (files: Array<File>, to: UploadDestination, replace?: { entry: EntryRow; entryFile: string; }) => Promise<void[]>; uploads: Upload[]; };