2 * Copyright (C) 2015 fulup
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 var reader = new FileReader();
19 // Closure to capture the file information.
20 reader.onload = (function(theFile) {
22 var $title = $("<h4>", {
25 $result.append($title);
26 var $fileContent = $("<ul>");
29 var dateBefore = new Date();
30 // read the content of the file with JSZip
31 var zip = new JSZip(e.target.result);
32 var dateAfter = new Date();
34 $title.append($("<span>", {
35 text:" (parsed in " + (dateAfter - dateBefore) + "ms)"
38 // that, or a good ol' for(var entryName in zip.files)
39 $.each(zip.files, function (index, zipEntry) {
40 $fileContent.append($("<li>", {
43 // the content is here : zipEntry.asText()
48 $fileContent = $("<div>", {
49 "class" : "alert alert-danger",
50 text : "Error reading " + theFile.name + " : " + e.message
53 $result.append($fileContent);