* Get a file handler for a given filename * @param {string} filename * @returns {Object|null} The matching handler or null if none found
(filename)
| 63 | * @returns {Object|null} The matching handler or null if none found |
| 64 | */ |
| 65 | getFileHandler(filename) { |
| 66 | const ext = filename.split(".").pop().toLowerCase(); |
| 67 | |
| 68 | for (const [id, handler] of this.#handlers) { |
| 69 | if ( |
| 70 | handler.extensions.includes(ext) || |
| 71 | handler.extensions.includes("*") |
| 72 | ) { |
| 73 | return { |
| 74 | id, |
| 75 | ...handler, |
| 76 | }; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | return null; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Get all registered handlers |