最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - How can I unzip the zipped file using AngularJs? - Stack Overflow

matteradmin5PV0评论

I want to unzip the zipped file while downloading the file using AngularJS.

I am trying with the following code,

For eg:

<a download="My_File.PNG" target="_self" ng-href="Path of the zip file/My_File.PNG.zip">My_File.PNG</a>

How can I download the actual file My_File.PNG from My_File.PNG.zip in the browser?

I want to unzip the zipped file while downloading the file using AngularJS.

I am trying with the following code,

For eg:

<a download="My_File.PNG" target="_self" ng-href="Path of the zip file/My_File.PNG.zip">My_File.PNG</a>

How can I download the actual file My_File.PNG from My_File.PNG.zip in the browser?

Share Improve this question asked Apr 7, 2014 at 13:23 GnikGnik 7,45821 gold badges82 silver badges139 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 2

You can't do it from angular directly, but you can call use the JSUnzip library which you can call from your angular controller https://github./augustl/js-unzip

     var myZip = ... // Get it with an XHR request, HTML5 files, etc.
     var unzipper = new JSUnzip(myZip);
     unzipper.isZipFile();      // true or false

     unzipper.readEntries();    // Creates "entries"
     unzipper.entries;          // Array of JSUnzip.ZipEntry objects.

It's a little bit late, but the problem is in the angular request. You have to pass a special parameter, as in
$http.get('...', { responseType: "arraybuffer" }).success(successfunc);
and then proceed with the unzip. Search for this...

Post a comment

comment list (0)

  1. No comments so far