@nexim/upload-sdk
Version:
TypeScript SDK for seamless integration with Nexim Media Upload Service. It provides state machine-based upload handling, progress tracking, and type-safe API for image optimization and file uploads.
24 lines • 855 B
TypeScript
import type { MaybePromise } from '@alwatr/type-helper';
/**
* Creates and triggers a virtual file input element to handle file selection.
* This utility creates a temporary file input element, attaches event handlers,
* and removes itself after use.
*
* Features:
* - Creates a hidden file input element
* - Handles file selection through browser's native interface
* - Automatically cleans up after selection
* - Supports async callbacks
*
* @example
* ```ts
* pickAndProcessFile('image/*', async (file) => {
* await uploadImage(file);
* });
* ```
*
* @param accept - Comma-separated list of allowed file types
* @param callback - Function to handle the selected file
*/
export declare function pickAndProcessFile(accept: string, callback: (file: File) => MaybePromise<void>): void;
//# sourceMappingURL=virtual-file-input.d.ts.map