Handle non-UTF-8 filenames
mainThe ZIP standard does not guarantee Unicode. If a zip file uses a different encoding for filenames, unzip() might fail to create a valid string key in the entries object. In these cases, use unzipRaw() to get an array of entries and access the entry.nameBytes property to decode the filename manually using your preferred encoding (e.g., TextDecoder).
// Using unzipRaw to handle non-UTF-8 names
const { entries } = await unzipRaw(blob);
for (const entry of entries) {
// Decode using a specific encoding like windows-1252
const decodedName = new TextDecoder('windows-1252').decode(entry.nameBytes);
console.log('Decoded filename:', decodedName);
}