@akadenia/helpers
Version:
Akadenia helpers
20 lines (19 loc) • 722 B
TypeScript
/**
* Check if a file path has a valid extension
* @param filePath The file path to check
* @param validExtensions The valid extensions
* @returns true if the file path has a valid extension
* @example
* checkFileExtension("test.geojson", ["geojson", "json"]) // true
* checkFileExtension("test.txt", ["md"]) // false
*/
export declare const checkFileExtension: (filePath: string, validExtensions: string[]) => boolean;
/**
* Format a file size to a human readable string
* @param bytes The file size in bytes
* @returns The formatted file size
* @example
* formatFileSize(1024) // "1.0 KB"
* formatFileSize(1024 * 1024) // "1.0 MB"
*/
export declare const formatFileSize: (bytes: number | null) => string;