Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!