Questions tagged [jszip]

Create, read and edit .zip files with Javascript

JSZip is a javascript zip class to create, read and edit .zip files with javascript

387 questions
25
votes
6 answers

Module not found: Error: Can't resolve 'stream' in 'C:\dev\jszip-test\node_modules\jszip\lib'

I'm using jszip v3.2.1 in an angular 7 application. When I build my project (running, for example, npm start) I'm getting the following error: ERROR in ./node_modules/jszip/lib/readable-stream-browser.js Module not found: Error: Can't resolve…
Ricardo Rocha
  • 14,612
  • 20
  • 74
  • 130
24
votes
2 answers

saveAs is not defined when using JSzip

I am getting an error when trying to do a simple jszip Uncaught (in promise) ReferenceError: saveAs is not defined Pretty sure I included all of the correct files so I am not sure what I am doing wrong, could someone please enlighten me? …
Nick Garver
  • 527
  • 1
  • 5
  • 18
20
votes
3 answers

Import JSZip in Angular 2 project

I am having troubles while importing the JSZip library in my Angular 2 project. I followed the following steps in order to change the project configuration: 1 - Install JSZip using NPM npm install jszip --save 2 - Change systemjs.config.js as…
AlexKibo88
  • 827
  • 1
  • 6
  • 16
19
votes
4 answers

Extracting zipped files using JSZIP in javascript

In my webpage, a user is supposed to upload a zipped file. Within the zipped file are 2 files: another zip file and a txt file. On my server, after receiving the zip, I want to unzip the zip file to extract the zip & txt file, then move those 2…
Cherple
  • 725
  • 3
  • 10
  • 24
19
votes
1 answer

Opening zip files in browser with FileReader and JSZip.js

I'm trying to open up zip files inside the browser with FileReader and JSZip.js, then handle the files contained inside. I can't figure out how to correctly pass the FileReader object to JSZip. Here's a stripped version of the page I use to load the…
P.Diddle
  • 191
  • 1
  • 1
  • 4
10
votes
1 answer

Show image from local zip with JSZip

I have a zip with a bunch of folders containing one or more png-files each that I want to render to the DOM. zip.loadAsync(file) .then(function(zip) { zip.file('textfile.txt') .async("string") .then(function (content) { console.log(content);…
mottosson
  • 3,283
  • 4
  • 35
  • 73
9
votes
2 answers

Multiple download links to one zip file before download javascript

Is it possible, in javascript, to have multiple download urls sent into one zip file and that zip file can be downloaded. So pretty much, on my web page, there is one button, that when clicked downloads a zip file of all the files from the download…
Dude1310
  • 127
  • 2
  • 3
  • 9
9
votes
4 answers

How to Zip files using jszip library

Am working on an offline application using HTML5 and jquery for mobile. i want to back up files from the local storage using jszip. below is a code snippet of what i have done... if (localStorageKeys.length > 0) { for (var i = 0; i <…
JoseLuke
  • 411
  • 2
  • 6
  • 14
8
votes
2 answers

How to wait for asynchronous JSZip .forEach() call to finish before running next code?

I have a global variable called 'data' that is being modified inside a forEach loop. However, since the loop is asynchronous, the code does not wait until data is populated before it continues with the code. This is using the JSZip library. let data…
Pranav
  • 149
  • 2
  • 6
8
votes
0 answers

What is Google Chrome's "Uncommon Download" warning based on?

I understand that Chrome's "Uncommon Download" warning is broadly based on how common a download is, but what are the specific conditions? Is "commonness" measured, or is it a heuristic? (eg. "zip files are always considered not common") If it is…
James
  • 773
  • 2
  • 18
  • 29
7
votes
1 answer

why the compression ration is 0 using JSZip

I converted my downloadable xml file to zip using the following code but the file size is sill same and the compression ratio shows 0% var xmlcontent = ""; xmlcontent += json2xml(data); …
مسعود
  • 679
  • 10
  • 25
7
votes
1 answer

Put generated PNG image into JSZip

I am using JSZip to make a program that generates the image data from a canvas element and puts the image into a zip file. Right now, it is turning the canvas image into an DataURL. Then, I get rid of the part of the resulting string that says…
Polygon
  • 265
  • 1
  • 2
  • 12
7
votes
1 answer

Adding images from url to a zip file using jsZip

I am trying to create a zip file using jsZip . The contents of the zip file are images from the web. I have created the following code. But when i run it all am getting is an empty zip file of 22kb.