Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

154
Vistas
Zipped File protected with password as "infected" or not using javascript zip.min.js?

I have the code that checks whether the file is zipped with the password "infected or not"? It works fine when the file is a single or standalone executable/application that is zipped with password infected.

It doesn't work properly when there is a lot of files and zipped together with password "infected".

const verifyZip = async (file, password, id) => {
            let reader;
            try {
                reader = new zip.ZipReader(new zip.BlobReader(file), { password });
                const entries = await reader.getEntries();

                if (entries[0].encrypted) {
                    for (const entry of entries) {
                        try {
                            // await entry.getData(new zip.BlobWriter(),
                                await entry.getData(new zip.BlobWriter(),
                                {
                                    onprogress: (index, max)=>{
                                        zip.BlobWriter.$cancel()
                                        reader.close()
                                    }
                                });
                        } catch (error) {
                            if (error.message === zip.ERR_ENCRYPTED ||
                                error.message === zip.ERR_INVALID_PASSWORD) {
                                alert(file.name +" incorrect password, zip file will not be uploaded.")
                                // myFunction(file,id)
                                uploader.removeFile(id)
                                map.remove(id);
                                // $('#' + file.id).find('td.zip').text('zip file is invalid');
                                return false;
                            } else {
                                throw error;
                            }
                        }
                    }
                }else{
                    alert(file.name + " zip file does not have a password please enter the appropriate password and upload again.")
                    uploader.removeFile(id)
                    map.remove(id);
                    // myFunction(file,id)
                }} finally {
                // await reader.close();
                reader.close();
            }
            return true;
        };

        if (fileSuffix==="zip"){
             verifyZip(file.source.source, "infected",file.id)
        }
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda