Javascript JSZip having error after adding image

I would like to download some a tampermonkey script that help me download images from a website and then packed as a zip file for me to download. I used JSZip for packing the images.

I have no problem following the sample code but when an image is added, then I would get the following error:

UnhandledPromiseRejectionWarning: Error: Invalid base64 input, it looks like a data url.

I placed my code in Runkit, if line 19 is commented (didn’t add the downloaded image into the zip file) everything will run smoothly. I am not sure how could I could add the image into the zip file.

Thanks in advance

78 thoughts on “Javascript JSZip having error after adding image”