mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-23 14:12:11 -03:00
refactor(import): Implement DownloadManager, FolderBrowser, ImageProcessor, and RecipeDataManager for enhanced recipe import functionality
- Added DownloadManager to handle saving recipes and downloading missing LoRAs. - Introduced FolderBrowser for selecting LoRA root directories and managing folder navigation. - Created ImageProcessor for handling image uploads and URL inputs for recipe analysis. - Developed RecipeDataManager to manage recipe details, including metadata and LoRA information. - Implemented ImportStepManager to control the flow of the import process and manage UI steps. - Added utility function for formatting file sizes for better user experience.
This commit is contained in:
12
static/js/utils/formatters.js
Normal file
12
static/js/utils/formatters.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Format a file size in bytes to a human-readable string
|
||||
* @param {number} bytes - The size in bytes
|
||||
* @returns {string} Formatted size string (e.g., "1.5 MB")
|
||||
*/
|
||||
export function formatFileSize(bytes) {
|
||||
if (!bytes || isNaN(bytes)) return '';
|
||||
|
||||
const sizes = ['B', 'KB', 'MB', 'GB'];
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
||||
return (bytes / Math.pow(1024, i)).toFixed(2) + ' ' + sizes[i];
|
||||
}
|
||||
Reference in New Issue
Block a user