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

I want to unzip the zipped file while downloading the file using AngularJS.I am trying with the followi

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...

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745622957a4636632.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信