@hirebus/academy
Version:
React component library for academy and learning platforms
44 lines (42 loc) • 1.38 kB
TypeScript
import { MimeType } from '../types/course';
/**
* Formats file size in bytes to a human-readable string
*/
export declare function formatFileSize(size: number): string;
/**
* Returns icon information based on file type
*/
export declare function getFileTypeIcon(fileType: MimeType): {
icon: string;
color: string;
};
/**
* Returns accepted file types based on upload type
*/
export declare function getAcceptedFileTypes(type: MimeType): string;
/**
* Returns human-readable formats for each upload type
*/
export declare function getReadableFormats(type: MimeType): string;
/**
* Extracts the first frame of a video file as a thumbnail image
*/
export declare const extractThumbnailFromVideo: (videoFile: File) => Promise<File | null>;
export declare const fetchThumbnailFile: (imageUrl: string) => Promise<{
id: string;
fileName: string;
size: number;
mimeType: MimeType;
file: File;
} | null>;
/**
* Gets the duration of a video file in seconds
*/
export declare const getVideoDuration: (videoFile: File) => Promise<number>;
/**
* Formats a duration in seconds to a human-readable string.
* - If seconds < 60: "SS seconds" (e.g., "32 seconds")
* - If 60 <= seconds < 3600: "MM:SS min" (e.g., "01:30 min")
* - If seconds >= 3600: "HH:MM hr" (e.g., "01:30 hr")
*/
export declare function formatDuration(totalSeconds: number): string;