mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-09 23:30:02 +00:00
refactor(assets): modular architecture + async two-phase scanner & background seeder (#12621)
This commit is contained in:
committed by
GitHub
parent
a7a6335be5
commit
29b24cb517
37
utils/mime_types.py
Normal file
37
utils/mime_types.py
Normal file
@@ -0,0 +1,37 @@
|
||||
"""Centralized MIME type initialization.
|
||||
|
||||
Call init_mime_types() once at startup to initialize the MIME type database
|
||||
and register all custom types used across ComfyUI.
|
||||
"""
|
||||
|
||||
import mimetypes
|
||||
|
||||
_initialized = False
|
||||
|
||||
|
||||
def init_mime_types():
|
||||
"""Initialize the MIME type database and register all custom types.
|
||||
|
||||
Safe to call multiple times; only runs once.
|
||||
"""
|
||||
global _initialized
|
||||
if _initialized:
|
||||
return
|
||||
_initialized = True
|
||||
|
||||
mimetypes.init()
|
||||
|
||||
# Web types (used by server.py for static file serving)
|
||||
mimetypes.add_type('application/javascript; charset=utf-8', '.js')
|
||||
mimetypes.add_type('image/webp', '.webp')
|
||||
|
||||
# Model and data file types (used by asset scanning / metadata extraction)
|
||||
mimetypes.add_type("application/safetensors", ".safetensors")
|
||||
mimetypes.add_type("application/safetensors", ".sft")
|
||||
mimetypes.add_type("application/pytorch", ".pt")
|
||||
mimetypes.add_type("application/pytorch", ".pth")
|
||||
mimetypes.add_type("application/pickle", ".ckpt")
|
||||
mimetypes.add_type("application/pickle", ".pkl")
|
||||
mimetypes.add_type("application/gguf", ".gguf")
|
||||
mimetypes.add_type("application/yaml", ".yaml")
|
||||
mimetypes.add_type("application/yaml", ".yml")
|
||||
Reference in New Issue
Block a user