* Try to get version from MANIFEST.MF
(zip: any, entries: any)
| 56 | * Try to get version from MANIFEST.MF |
| 57 | */ |
| 58 | private async getVersionFromManifest(zip: any, entries: any): Promise<string | null> { |
| 59 | const manifestPath = "META-INF/MANIFEST.MF"; |
| 60 | if (!entries[manifestPath]) return null; |
| 61 | const data = await zip.entryData(manifestPath); |
| 62 | const content = data.toString(); |
| 63 | // Use regex to match Implementation-Version or Specification-Version |
| 64 | const match = content.match(/Implementation-Version:\s*(.+)/i) |
| 65 | || content.match(/Specification-Version:\s*(.+)/i); |
| 66 | return match ? match[1].trim() : null; |
| 67 | } |
| 68 | |
| 69 | private async parseJarMetadata(jarPath: string): Promise<Partial<ModInfo> | null> { |
| 70 | const zip = new StreamZip.async({ file: jarPath }); |