HOW TO: Export / Backup Readium Chrome App EPUB database as ZIP #755
danielweck
started this conversation in
Show and tell
Replies: 1 comment
-
DIFF PATCH FOR 64816c64816
< define('StorageManager',['readium_js_viewer/workers/Messages'], function(Messages){
---
> define('StorageManager',['readium_js_viewer/workers/Messages', 'readium_js_viewer/workers/WorkerProxy'], function(Messages, WorkerProxy){
65105a65106
> getRootDir: function(){return rootDir},
65106a65108
> const that = this;
65112a65115,65145
>
> setTimeout(() => {
> WorkerProxy.exportAllZip({
> progress : () => {},
> overwrite: () => {},
> success: (markup) => {
> const url = `filesystem:chrome-extension://${window.location.hostname}/persistent/readium-db.zip`;
>
> // window.document.querySelector("body").innerHTML = `<div style="overflow: scroll; width: 100%; height: 100%; border: 4px solid blue; box-sizing: border-box; padding: 4px;"><p><span style="font-weight: bold;"><hr/>${url}<hr/>${markup}<hr/><hr/></div>`;
>
> that.getRootDir().getFile("readium-db.zip", {create:false}, (fsEntry) => {
> fsEntry.file((f) => {
> window.document.querySelector("body").innerHTML = `<div style="overflow: scroll; width: 100%; height: 100%; border: 4px solid blue; box-sizing: border-box; padding: 4px;"><a download="readium-database.zip" href="${url}" style="font-size: 3em;">${url}</a><hr/><p><span style="font-weight: bold;">${fsEntry.fullPath}</span> (${f.size})</p><hr/>${markup}</div>`;
>
> // const fileReader = new FileReader();
> // fileReader.onloadend = (err) => {
>
> // window.document.querySelector("body").innerHTML = `<a download="readium-database.zip" href="${url}">${url}</a><hr/><div style="overflow: scroll; width: 100%; height: 100%; border: 4px solid blue; box-sizing: border-box; padding: 4px;"><p><span style="font-weight: bold;">${fsEntry.fullPath}</span> (${f.size} || ${fileReader.result ? fileReader.result.byteLength : err})</p><hr/>${markup}</div>`;
> // }
> // fileReader.readAsArrayBuffer(f); // readAsBinaryString() readAsDataURL() readAsText()
> });
> }, (err) => {
> window.document.querySelector("body").innerHTML = `<div style="overflow: scroll; width: 100%; height: 100%; border: 4px solid red; box-sizing: border-box;">ERROR!! ${JSON.stringify(err)}<br/>${markup}</div>`;
> });
> },
> error: (err) => {
> window.document.querySelector("body").innerHTML = `<div style="overflow: scroll; width: 100%; height: 100%; border: 4px solid red; box-sizing: border-box;">ERROR!! ${JSON.stringify(err)}</div>`;
> },
> });
> }, 2000);
>
65583a65617,65619
> },
> exportAllZip : function(callbacks){
> doWork({msg: "EXPORT_ALL_ZIP"}, callbacks);
73763,73795c73799,73831
< (function(factory) {
< if (typeof define === 'function' && define.amd) {
< define('jquery_hammer',['jquery', 'hammerjs'], factory);
< } else if (typeof exports === 'object') {
< factory(require('jquery'), require('hammerjs'));
< } else {
< factory(jQuery, Hammer);
< }
< }(function($, Hammer) {
< function hammerify(el, options) {
< var $el = $(el);
< if(!$el.data("hammer")) {
< $el.data("hammer", new Hammer($el[0], options));
< }
< }
<
< $.fn.hammer = function(options) {
< return this.each(function() {
< hammerify(this, options);
< });
< };
<
< // extend the emit method to also trigger jQuery events
< Hammer.Manager.prototype.emit = (function(originalEmit) {
< return function(type, data) {
< originalEmit.call(this, type, data);
< $(this.element).trigger({
< type: type,
< gesture: data
< });
< };
< })(Hammer.Manager.prototype.emit);
< }));
---
> (function(factory) {
> if (typeof define === 'function' && define.amd) {
> define('jquery_hammer',['jquery', 'hammerjs'], factory);
> } else if (typeof exports === 'object') {
> factory(require('jquery'), require('hammerjs'));
> } else {
> factory(jQuery, Hammer);
> }
> }(function($, Hammer) {
> function hammerify(el, options) {
> var $el = $(el);
> if(!$el.data("hammer")) {
> $el.data("hammer", new Hammer($el[0], options));
> }
> }
>
> $.fn.hammer = function(options) {
> return this.each(function() {
> hammerify(this, options);
> });
> };
>
> // extend the emit method to also trigger jQuery events
> Hammer.Manager.prototype.emit = (function(originalEmit) {
> return function(type, data) {
> originalEmit.call(this, type, data);
> $(this.element).trigger({
> type: type,
> gesture: data
> });
> };
> })(Hammer.Manager.prototype.emit);
> })); DIFF PATCH FOR 845a846
> getRootDir: function(){return rootDir},
852a854
>
1603c1605,1606
< add : function(name, reader, onend, onprogress, options) {
---
> add : function( // func,
> name, reader, onend, onprogress, options) {
1658a1662
>
1669c1673
< else
---
> else {
1670a1675,1676
> // return func("-!!!!" + typeof deflate);
> }
1676c1682
< if (reader)
---
> if (reader) {
1677a1684
> }
1871a1879,3718
> (function() {
> "use strict";
> var table = {
> "application" : {
> "andrew-inset" : "ez",
> "annodex" : "anx",
> "atom+xml" : "atom",
> "atomcat+xml" : "atomcat",
> "atomserv+xml" : "atomsrv",
> "bbolin" : "lin",
> "cap" : [ "cap", "pcap" ],
> "cu-seeme" : "cu",
> "davmount+xml" : "davmount",
> "dsptype" : "tsp",
> "ecmascript" : [ "es", "ecma" ],
> "futuresplash" : "spl",
> "hta" : "hta",
> "java-archive" : "jar",
> "java-serialized-object" : "ser",
> "java-vm" : "class",
> "javascript" : "js",
> "m3g" : "m3g",
> "mac-binhex40" : "hqx",
> "mathematica" : [ "nb", "ma", "mb" ],
> "msaccess" : "mdb",
> "msword" : [ "doc", "dot" ],
> "mxf" : "mxf",
> "oda" : "oda",
> "ogg" : "ogx",
> "pdf" : "pdf",
> "pgp-keys" : "key",
> "pgp-signature" : [ "asc", "sig" ],
> "pics-rules" : "prf",
> "postscript" : [ "ps", "ai", "eps", "epsi", "epsf", "eps2", "eps3" ],
> "rar" : "rar",
> "rdf+xml" : "rdf",
> "rss+xml" : "rss",
> "rtf" : "rtf",
> "smil" : [ "smi", "smil" ],
> "xhtml+xml" : [ "xhtml", "xht" ],
> "xml" : [ "xml", "xsl", "xsd" ],
> "xspf+xml" : "xspf",
> "zip" : "zip",
> "vnd.android.package-archive" : "apk",
> "vnd.cinderella" : "cdy",
> "vnd.google-earth.kml+xml" : "kml",
> "vnd.google-earth.kmz" : "kmz",
> "vnd.mozilla.xul+xml" : "xul",
> "vnd.ms-excel" : [ "xls", "xlb", "xlt", "xlm", "xla", "xlc", "xlw" ],
> "vnd.ms-pki.seccat" : "cat",
> "vnd.ms-pki.stl" : "stl",
> "vnd.ms-powerpoint" : [ "ppt", "pps", "pot" ],
> "vnd.oasis.opendocument.chart" : "odc",
> "vnd.oasis.opendocument.database" : "odb",
> "vnd.oasis.opendocument.formula" : "odf",
> "vnd.oasis.opendocument.graphics" : "odg",
> "vnd.oasis.opendocument.graphics-template" : "otg",
> "vnd.oasis.opendocument.image" : "odi",
> "vnd.oasis.opendocument.presentation" : "odp",
> "vnd.oasis.opendocument.presentation-template" : "otp",
> "vnd.oasis.opendocument.spreadsheet" : "ods",
> "vnd.oasis.opendocument.spreadsheet-template" : "ots",
> "vnd.oasis.opendocument.text" : "odt",
> "vnd.oasis.opendocument.text-master" : "odm",
> "vnd.oasis.opendocument.text-template" : "ott",
> "vnd.oasis.opendocument.text-web" : "oth",
> "vnd.openxmlformats-officedocument.spreadsheetml.sheet" : "xlsx",
> "vnd.openxmlformats-officedocument.spreadsheetml.template" : "xltx",
> "vnd.openxmlformats-officedocument.presentationml.presentation" : "pptx",
> "vnd.openxmlformats-officedocument.presentationml.slideshow" : "ppsx",
> "vnd.openxmlformats-officedocument.presentationml.template" : "potx",
> "vnd.openxmlformats-officedocument.wordprocessingml.document" : "docx",
> "vnd.openxmlformats-officedocument.wordprocessingml.template" : "dotx",
> "vnd.smaf" : "mmf",
> "vnd.stardivision.calc" : "sdc",
> "vnd.stardivision.chart" : "sds",
> "vnd.stardivision.draw" : "sda",
> "vnd.stardivision.impress" : "sdd",
> "vnd.stardivision.math" : [ "sdf", "smf" ],
> "vnd.stardivision.writer" : [ "sdw", "vor" ],
> "vnd.stardivision.writer-global" : "sgl",
> "vnd.sun.xml.calc" : "sxc",
> "vnd.sun.xml.calc.template" : "stc",
> "vnd.sun.xml.draw" : "sxd",
> "vnd.sun.xml.draw.template" : "std",
> "vnd.sun.xml.impress" : "sxi",
> "vnd.sun.xml.impress.template" : "sti",
> "vnd.sun.xml.math" : "sxm",
> "vnd.sun.xml.writer" : "sxw",
> "vnd.sun.xml.writer.global" : "sxg",
> "vnd.sun.xml.writer.template" : "stw",
> "vnd.symbian.install" : [ "sis", "sisx" ],
> "vnd.visio" : [ "vsd", "vst", "vss", "vsw" ],
> "vnd.wap.wbxml" : "wbxml",
> "vnd.wap.wmlc" : "wmlc",
> "vnd.wap.wmlscriptc" : "wmlsc",
> "vnd.wordperfect" : "wpd",
> "vnd.wordperfect5.1" : "wp5",
> "x-123" : "wk",
> "x-7z-compressed" : "7z",
> "x-abiword" : "abw",
> "x-apple-diskimage" : "dmg",
> "x-bcpio" : "bcpio",
> "x-bittorrent" : "torrent",
> "x-cbr" : [ "cbr", "cba", "cbt", "cb7" ],
> "x-cbz" : "cbz",
> "x-cdf" : [ "cdf", "cda" ],
> "x-cdlink" : "vcd",
> "x-chess-pgn" : "pgn",
> "x-cpio" : "cpio",
> "x-csh" : "csh",
> "x-debian-package" : [ "deb", "udeb" ],
> "x-director" : [ "dcr", "dir", "dxr", "cst", "cct", "cxt", "w3d", "fgd", "swa" ],
> "x-dms" : "dms",
> "x-doom" : "wad",
> "x-dvi" : "dvi",
> "x-httpd-eruby" : "rhtml",
> "x-font" : "pcf.Z",
> "x-freemind" : "mm",
> "x-gnumeric" : "gnumeric",
> "x-go-sgf" : "sgf",
> "x-graphing-calculator" : "gcf",
> "x-gtar" : [ "gtar", "taz" ],
> "x-hdf" : "hdf",
> "x-httpd-php" : [ "phtml", "pht", "php" ],
> "x-httpd-php-source" : "phps",
> "x-httpd-php3" : "php3",
> "x-httpd-php3-preprocessed" : "php3p",
> "x-httpd-php4" : "php4",
> "x-httpd-php5" : "php5",
> "x-ica" : "ica",
> "x-info" : "info",
> "x-internet-signup" : [ "ins", "isp" ],
> "x-iphone" : "iii",
> "x-iso9660-image" : "iso",
> "x-java-jnlp-file" : "jnlp",
> "x-jmol" : "jmz",
> "x-killustrator" : "kil",
> "x-koan" : [ "skp", "skd", "skt", "skm" ],
> "x-kpresenter" : [ "kpr", "kpt" ],
> "x-kword" : [ "kwd", "kwt" ],
> "x-latex" : "latex",
> "x-lha" : "lha",
> "x-lyx" : "lyx",
> "x-lzh" : "lzh",
> "x-lzx" : "lzx",
> "x-maker" : [ "frm", "maker", "frame", "fm", "fb", "book", "fbdoc" ],
> "x-ms-wmd" : "wmd",
> "x-ms-wmz" : "wmz",
> "x-msdos-program" : [ "com", "exe", "bat", "dll" ],
> "x-msi" : "msi",
> "x-netcdf" : [ "nc", "cdf" ],
> "x-ns-proxy-autoconfig" : [ "pac", "dat" ],
> "x-nwc" : "nwc",
> "x-object" : "o",
> "x-oz-application" : "oza",
> "x-pkcs7-certreqresp" : "p7r",
> "x-python-code" : [ "pyc", "pyo" ],
> "x-qgis" : [ "qgs", "shp", "shx" ],
> "x-quicktimeplayer" : "qtl",
> "x-redhat-package-manager" : "rpm",
> "x-ruby" : "rb",
> "x-sh" : "sh",
> "x-shar" : "shar",
> "x-shockwave-flash" : [ "swf", "swfl" ],
> "x-silverlight" : "scr",
> "x-stuffit" : "sit",
> "x-sv4cpio" : "sv4cpio",
> "x-sv4crc" : "sv4crc",
> "x-tar" : "tar",
> "x-tcl" : "tcl",
> "x-tex-gf" : "gf",
> "x-tex-pk" : "pk",
> "x-texinfo" : [ "texinfo", "texi" ],
> "x-trash" : [ "~", "%", "bak", "old", "sik" ],
> "x-troff" : [ "t", "tr", "roff" ],
> "x-troff-man" : "man",
> "x-troff-me" : "me",
> "x-troff-ms" : "ms",
> "x-ustar" : "ustar",
> "x-wais-source" : "src",
> "x-wingz" : "wz",
> "x-x509-ca-cert" : [ "crt", "der", "cer" ],
> "x-xcf" : "xcf",
> "x-xfig" : "fig",
> "x-xpinstall" : "xpi",
> "applixware" : "aw",
> "atomsvc+xml" : "atomsvc",
> "ccxml+xml" : "ccxml",
> "cdmi-capability" : "cdmia",
> "cdmi-container" : "cdmic",
> "cdmi-domain" : "cdmid",
> "cdmi-object" : "cdmio",
> "cdmi-queue" : "cdmiq",
> "docbook+xml" : "dbk",
> "dssc+der" : "dssc",
> "dssc+xml" : "xdssc",
> "emma+xml" : "emma",
> "epub+zip" : "epub",
> "exi" : "exi",
> "font-tdpfr" : "pfr",
> "gml+xml" : "gml",
> "gpx+xml" : "gpx",
> "gxf" : "gxf",
> "hyperstudio" : "stk",
> "inkml+xml" : [ "ink", "inkml" ],
> "ipfix" : "ipfix",
> "json" : "json",
> "jsonml+json" : "jsonml",
> "lost+xml" : "lostxml",
> "mads+xml" : "mads",
> "marc" : "mrc",
> "marcxml+xml" : "mrcx",
> "mathml+xml" : "mathml",
> "mbox" : "mbox",
> "mediaservercontrol+xml" : "mscml",
> "metalink+xml" : "metalink",
> "metalink4+xml" : "meta4",
> "mets+xml" : "mets",
> "mods+xml" : "mods",
> "mp21" : [ "m21", "mp21" ],
> "mp4" : "mp4s",
> "oebps-package+xml" : "opf",
> "omdoc+xml" : "omdoc",
> "onenote" : [ "onetoc", "onetoc2", "onetmp", "onepkg" ],
> "oxps" : "oxps",
> "patch-ops-error+xml" : "xer",
> "pgp-encrypted" : "pgp",
> "pkcs10" : "p10",
> "pkcs7-mime" : [ "p7m", "p7c" ],
> "pkcs7-signature" : "p7s",
> "pkcs8" : "p8",
> "pkix-attr-cert" : "ac",
> "pkix-crl" : "crl",
> "pkix-pkipath" : "pkipath",
> "pkixcmp" : "pki",
> "pls+xml" : "pls",
> "prs.cww" : "cww",
> "pskc+xml" : "pskcxml",
> "reginfo+xml" : "rif",
> "relax-ng-compact-syntax" : "rnc",
> "resource-lists+xml" : "rl",
> "resource-lists-diff+xml" : "rld",
> "rls-services+xml" : "rs",
> "rpki-ghostbusters" : "gbr",
> "rpki-manifest" : "mft",
> "rpki-roa" : "roa",
> "rsd+xml" : "rsd",
> "sbml+xml" : "sbml",
> "scvp-cv-request" : "scq",
> "scvp-cv-response" : "scs",
> "scvp-vp-request" : "spq",
> "scvp-vp-response" : "spp",
> "sdp" : "sdp",
> "set-payment-initiation" : "setpay",
> "set-registration-initiation" : "setreg",
> "shf+xml" : "shf",
> "sparql-query" : "rq",
> "sparql-results+xml" : "srx",
> "srgs" : "gram",
> "srgs+xml" : "grxml",
> "sru+xml" : "sru",
> "ssdl+xml" : "ssdl",
> "ssml+xml" : "ssml",
> "tei+xml" : [ "tei", "teicorpus" ],
> "thraud+xml" : "tfi",
> "timestamped-data" : "tsd",
> "vnd.3gpp.pic-bw-large" : "plb",
> "vnd.3gpp.pic-bw-small" : "psb",
> "vnd.3gpp.pic-bw-var" : "pvb",
> "vnd.3gpp2.tcap" : "tcap",
> "vnd.3m.post-it-notes" : "pwn",
> "vnd.accpac.simply.aso" : "aso",
> "vnd.accpac.simply.imp" : "imp",
> "vnd.acucobol" : "acu",
> "vnd.acucorp" : [ "atc", "acutc" ],
> "vnd.adobe.air-application-installer-package+zip" : "air",
> "vnd.adobe.formscentral.fcdt" : "fcdt",
> "vnd.adobe.fxp" : [ "fxp", "fxpl" ],
> "vnd.adobe.xdp+xml" : "xdp",
> "vnd.adobe.xfdf" : "xfdf",
> "vnd.ahead.space" : "ahead",
> "vnd.airzip.filesecure.azf" : "azf",
> "vnd.airzip.filesecure.azs" : "azs",
> "vnd.amazon.ebook" : "azw",
> "vnd.americandynamics.acc" : "acc",
> "vnd.amiga.ami" : "ami",
> "vnd.anser-web-certificate-issue-initiation" : "cii",
> "vnd.anser-web-funds-transfer-initiation" : "fti",
> "vnd.antix.game-component" : "atx",
> "vnd.apple.installer+xml" : "mpkg",
> "vnd.apple.mpegurl" : "m3u8",
> "vnd.aristanetworks.swi" : "swi",
> "vnd.astraea-software.iota" : "iota",
> "vnd.audiograph" : "aep",
> "vnd.blueice.multipass" : "mpm",
> "vnd.bmi" : "bmi",
> "vnd.businessobjects" : "rep",
> "vnd.chemdraw+xml" : "cdxml",
> "vnd.chipnuts.karaoke-mmd" : "mmd",
> "vnd.claymore" : "cla",
> "vnd.cloanto.rp9" : "rp9",
> "vnd.clonk.c4group" : [ "c4g", "c4d", "c4f", "c4p", "c4u" ],
> "vnd.cluetrust.cartomobile-config" : "c11amc",
> "vnd.cluetrust.cartomobile-config-pkg" : "c11amz",
> "vnd.commonspace" : "csp",
> "vnd.contact.cmsg" : "cdbcmsg",
> "vnd.cosmocaller" : "cmc",
> "vnd.crick.clicker" : "clkx",
> "vnd.crick.clicker.keyboard" : "clkk",
> "vnd.crick.clicker.palette" : "clkp",
> "vnd.crick.clicker.template" : "clkt",
> "vnd.crick.clicker.wordbank" : "clkw",
> "vnd.criticaltools.wbs+xml" : "wbs",
> "vnd.ctc-posml" : "pml",
> "vnd.cups-ppd" : "ppd",
> "vnd.curl.car" : "car",
> "vnd.curl.pcurl" : "pcurl",
> "vnd.dart" : "dart",
> "vnd.data-vision.rdz" : "rdz",
> "vnd.dece.data" : [ "uvf", "uvvf", "uvd", "uvvd" ],
> "vnd.dece.ttml+xml" : [ "uvt", "uvvt" ],
> "vnd.dece.unspecified" : [ "uvx", "uvvx" ],
> "vnd.dece.zip" : [ "uvz", "uvvz" ],
> "vnd.denovo.fcselayout-link" : "fe_launch",
> "vnd.dna" : "dna",
> "vnd.dolby.mlp" : "mlp",
> "vnd.dpgraph" : "dpg",
> "vnd.dreamfactory" : "dfac",
> "vnd.ds-keypoint" : "kpxx",
> "vnd.dvb.ait" : "ait",
> "vnd.dvb.service" : "svc",
> "vnd.dynageo" : "geo",
> "vnd.ecowin.chart" : "mag",
> "vnd.enliven" : "nml",
> "vnd.epson.esf" : "esf",
> "vnd.epson.msf" : "msf",
> "vnd.epson.quickanime" : "qam",
> "vnd.epson.salt" : "slt",
> "vnd.epson.ssf" : "ssf",
> "vnd.eszigno3+xml" : [ "es3", "et3" ],
> "vnd.ezpix-album" : "ez2",
> "vnd.ezpix-package" : "ez3",
> "vnd.fdf" : "fdf",
> "vnd.fdsn.mseed" : "mseed",
> "vnd.fdsn.seed" : [ "seed", "dataless" ],
> "vnd.flographit" : "gph",
> "vnd.fluxtime.clip" : "ftc",
> "vnd.framemaker" : [ "fm", "frame", "maker", "book" ],
> "vnd.frogans.fnc" : "fnc",
> "vnd.frogans.ltf" : "ltf",
> "vnd.fsc.weblaunch" : "fsc",
> "vnd.fujitsu.oasys" : "oas",
> "vnd.fujitsu.oasys2" : "oa2",
> "vnd.fujitsu.oasys3" : "oa3",
> "vnd.fujitsu.oasysgp" : "fg5",
> "vnd.fujitsu.oasysprs" : "bh2",
> "vnd.fujixerox.ddd" : "ddd",
> "vnd.fujixerox.docuworks" : "xdw",
> "vnd.fujixerox.docuworks.binder" : "xbd",
> "vnd.fuzzysheet" : "fzs",
> "vnd.genomatix.tuxedo" : "txd",
> "vnd.geogebra.file" : "ggb",
> "vnd.geogebra.tool" : "ggt",
> "vnd.geometry-explorer" : [ "gex", "gre" ],
> "vnd.geonext" : "gxt",
> "vnd.geoplan" : "g2w",
> "vnd.geospace" : "g3w",
> "vnd.gmx" : "gmx",
> "vnd.grafeq" : [ "gqf", "gqs" ],
> "vnd.groove-account" : "gac",
> "vnd.groove-help" : "ghf",
> "vnd.groove-identity-message" : "gim",
> "vnd.groove-injector" : "grv",
> "vnd.groove-tool-message" : "gtm",
> "vnd.groove-tool-template" : "tpl",
> "vnd.groove-vcard" : "vcg",
> "vnd.hal+xml" : "hal",
> "vnd.handheld-entertainment+xml" : "zmm",
> "vnd.hbci" : "hbci",
> "vnd.hhe.lesson-player" : "les",
> "vnd.hp-hpgl" : "hpgl",
> "vnd.hp-hpid" : "hpid",
> "vnd.hp-hps" : "hps",
> "vnd.hp-jlyt" : "jlt",
> "vnd.hp-pcl" : "pcl",
> "vnd.hp-pclxl" : "pclxl",
> "vnd.hydrostatix.sof-data" : "sfd-hdstx",
> "vnd.ibm.minipay" : "mpy",
> "vnd.ibm.modcap" : [ "afp", "listafp", "list3820" ],
> "vnd.ibm.rights-management" : "irm",
> "vnd.ibm.secure-container" : "sc",
> "vnd.iccprofile" : [ "icc", "icm" ],
> "vnd.igloader" : "igl",
> "vnd.immervision-ivp" : "ivp",
> "vnd.immervision-ivu" : "ivu",
> "vnd.insors.igm" : "igm",
> "vnd.intercon.formnet" : [ "xpw", "xpx" ],
> "vnd.intergeo" : "i2g",
> "vnd.intu.qbo" : "qbo",
> "vnd.intu.qfx" : "qfx",
> "vnd.ipunplugged.rcprofile" : "rcprofile",
> "vnd.irepository.package+xml" : "irp",
> "vnd.is-xpr" : "xpr",
> "vnd.isac.fcs" : "fcs",
> "vnd.jam" : "jam",
> "vnd.jcp.javame.midlet-rms" : "rms",
> "vnd.jisp" : "jisp",
> "vnd.joost.joda-archive" : "joda",
> "vnd.kahootz" : [ "ktz", "ktr" ],
> "vnd.kde.karbon" : "karbon",
> "vnd.kde.kchart" : "chrt",
> "vnd.kde.kformula" : "kfo",
> "vnd.kde.kivio" : "flw",
> "vnd.kde.kontour" : "kon",
> "vnd.kde.kpresenter" : [ "kpr", "kpt" ],
> "vnd.kde.kspread" : "ksp",
> "vnd.kde.kword" : [ "kwd", "kwt" ],
> "vnd.kenameaapp" : "htke",
> "vnd.kidspiration" : "kia",
> "vnd.kinar" : [ "kne", "knp" ],
> "vnd.koan" : [ "skp", "skd", "skt", "skm" ],
> "vnd.kodak-descriptor" : "sse",
> "vnd.las.las+xml" : "lasxml",
> "vnd.llamagraphics.life-balance.desktop" : "lbd",
> "vnd.llamagraphics.life-balance.exchange+xml" : "lbe",
> "vnd.lotus-1-2-3" : "123",
> "vnd.lotus-approach" : "apr",
> "vnd.lotus-freelance" : "pre",
> "vnd.lotus-notes" : "nsf",
> "vnd.lotus-organizer" : "org",
> "vnd.lotus-screencam" : "scm",
> "vnd.lotus-wordpro" : "lwp",
> "vnd.macports.portpkg" : "portpkg",
> "vnd.mcd" : "mcd",
> "vnd.medcalcdata" : "mc1",
> "vnd.mediastation.cdkey" : "cdkey",
> "vnd.mfer" : "mwf",
> "vnd.mfmp" : "mfm",
> "vnd.micrografx.flo" : "flo",
> "vnd.micrografx.igx" : "igx",
> "vnd.mif" : "mif",
> "vnd.mobius.daf" : "daf",
> "vnd.mobius.dis" : "dis",
> "vnd.mobius.mbk" : "mbk",
> "vnd.mobius.mqy" : "mqy",
> "vnd.mobius.msl" : "msl",
> "vnd.mobius.plc" : "plc",
> "vnd.mobius.txf" : "txf",
> "vnd.mophun.application" : "mpn",
> "vnd.mophun.certificate" : "mpc",
> "vnd.ms-artgalry" : "cil",
> "vnd.ms-cab-compressed" : "cab",
> "vnd.ms-excel.addin.macroenabled.12" : "xlam",
> "vnd.ms-excel.sheet.binary.macroenabled.12" : "xlsb",
> "vnd.ms-excel.sheet.macroenabled.12" : "xlsm",
> "vnd.ms-excel.template.macroenabled.12" : "xltm",
> "vnd.ms-fontobject" : "eot",
> "vnd.ms-htmlhelp" : "chm",
> "vnd.ms-ims" : "ims",
> "vnd.ms-lrm" : "lrm",
> "vnd.ms-officetheme" : "thmx",
> "vnd.ms-powerpoint.addin.macroenabled.12" : "ppam",
> "vnd.ms-powerpoint.presentation.macroenabled.12" : "pptm",
> "vnd.ms-powerpoint.slide.macroenabled.12" : "sldm",
> "vnd.ms-powerpoint.slideshow.macroenabled.12" : "ppsm",
> "vnd.ms-powerpoint.template.macroenabled.12" : "potm",
> "vnd.ms-project" : [ "mpp", "mpt" ],
> "vnd.ms-word.document.macroenabled.12" : "docm",
> "vnd.ms-word.template.macroenabled.12" : "dotm",
> "vnd.ms-works" : [ "wps", "wks", "wcm", "wdb" ],
> "vnd.ms-wpl" : "wpl",
> "vnd.ms-xpsdocument" : "xps",
> "vnd.mseq" : "mseq",
> "vnd.musician" : "mus",
> "vnd.muvee.style" : "msty",
> "vnd.mynfc" : "taglet",
> "vnd.neurolanguage.nlu" : "nlu",
> "vnd.nitf" : [ "ntf", "nitf" ],
> "vnd.noblenet-directory" : "nnd",
> "vnd.noblenet-sealer" : "nns",
> "vnd.noblenet-web" : "nnw",
> "vnd.nokia.n-gage.data" : "ngdat",
> "vnd.nokia.n-gage.symbian.install" : "n-gage",
> "vnd.nokia.radio-preset" : "rpst",
> "vnd.nokia.radio-presets" : "rpss",
> "vnd.novadigm.edm" : "edm",
> "vnd.novadigm.edx" : "edx",
> "vnd.novadigm.ext" : "ext",
> "vnd.oasis.opendocument.chart-template" : "otc",
> "vnd.oasis.opendocument.formula-template" : "odft",
> "vnd.oasis.opendocument.image-template" : "oti",
> "vnd.olpc-sugar" : "xo",
> "vnd.oma.dd2+xml" : "dd2",
> "vnd.openofficeorg.extension" : "oxt",
> "vnd.openxmlformats-officedocument.presentationml.slide" : "sldx",
> "vnd.osgeo.mapguide.package" : "mgp",
> "vnd.osgi.dp" : "dp",
> "vnd.osgi.subsystem" : "esa",
> "vnd.palm" : [ "pdb", "pqa", "oprc" ],
> "vnd.pawaafile" : "paw",
> "vnd.pg.format" : "str",
> "vnd.pg.osasli" : "ei6",
> "vnd.picsel" : "efif",
> "vnd.pmi.widget" : "wg",
> "vnd.pocketlearn" : "plf",
> "vnd.powerbuilder6" : "pbd",
> "vnd.previewsystems.box" : "box",
> "vnd.proteus.magazine" : "mgz",
> "vnd.publishare-delta-tree" : "qps",
> "vnd.pvi.ptid1" : "ptid",
> "vnd.quark.quarkxpress" : [ "qxd", "qxt", "qwd", "qwt", "qxl", "qxb" ],
> "vnd.realvnc.bed" : "bed",
> "vnd.recordare.musicxml" : "mxl",
> "vnd.recordare.musicxml+xml" : "musicxml",
> "vnd.rig.cryptonote" : "cryptonote",
> "vnd.rn-realmedia" : "rm",
> "vnd.rn-realmedia-vbr" : "rmvb",
> "vnd.route66.link66+xml" : "link66",
> "vnd.sailingtracker.track" : "st",
> "vnd.seemail" : "see",
> "vnd.sema" : "sema",
> "vnd.semd" : "semd",
> "vnd.semf" : "semf",
> "vnd.shana.informed.formdata" : "ifm",
> "vnd.shana.informed.formtemplate" : "itp",
> "vnd.shana.informed.interchange" : "iif",
> "vnd.shana.informed.package" : "ipk",
> "vnd.simtech-mindmapper" : [ "twd", "twds" ],
> "vnd.smart.teacher" : "teacher",
> "vnd.solent.sdkm+xml" : [ "sdkm", "sdkd" ],
> "vnd.spotfire.dxp" : "dxp",
> "vnd.spotfire.sfs" : "sfs",
> "vnd.stepmania.package" : "smzip",
> "vnd.stepmania.stepchart" : "sm",
> "vnd.sus-calendar" : [ "sus", "susp" ],
> "vnd.svd" : "svd",
> "vnd.syncml+xml" : "xsm",
> "vnd.syncml.dm+wbxml" : "bdm",
> "vnd.syncml.dm+xml" : "xdm",
> "vnd.tao.intent-module-archive" : "tao",
> "vnd.tcpdump.pcap" : [ "pcap", "cap", "dmp" ],
> "vnd.tmobile-livetv" : "tmo",
> "vnd.trid.tpt" : "tpt",
> "vnd.triscape.mxs" : "mxs",
> "vnd.trueapp" : "tra",
> "vnd.ufdl" : [ "ufd", "ufdl" ],
> "vnd.uiq.theme" : "utz",
> "vnd.umajin" : "umj",
> "vnd.unity" : "unityweb",
> "vnd.uoml+xml" : "uoml",
> "vnd.vcx" : "vcx",
> "vnd.visionary" : "vis",
> "vnd.vsf" : "vsf",
> "vnd.webturbo" : "wtb",
> "vnd.wolfram.player" : "nbp",
> "vnd.wqd" : "wqd",
> "vnd.wt.stf" : "stf",
> "vnd.xara" : "xar",
> "vnd.xfdl" : "xfdl",
> "vnd.yamaha.hv-dic" : "hvd",
> "vnd.yamaha.hv-script" : "hvs",
> "vnd.yamaha.hv-voice" : "hvp",
> "vnd.yamaha.openscoreformat" : "osf",
> "vnd.yamaha.openscoreformat.osfpvg+xml" : "osfpvg",
> "vnd.yamaha.smaf-audio" : "saf",
> "vnd.yamaha.smaf-phrase" : "spf",
> "vnd.yellowriver-custom-menu" : "cmp",
> "vnd.zul" : [ "zir", "zirz" ],
> "vnd.zzazz.deck+xml" : "zaz",
> "voicexml+xml" : "vxml",
> "widget" : "wgt",
> "winhlp" : "hlp",
> "wsdl+xml" : "wsdl",
> "wspolicy+xml" : "wspolicy",
> "x-ace-compressed" : "ace",
> "x-authorware-bin" : [ "aab", "x32", "u32", "vox" ],
> "x-authorware-map" : "aam",
> "x-authorware-seg" : "aas",
> "x-blorb" : [ "blb", "blorb" ],
> "x-bzip" : "bz",
> "x-bzip2" : [ "bz2", "boz" ],
> "x-cfs-compressed" : "cfs",
> "x-chat" : "chat",
> "x-conference" : "nsc",
> "x-dgc-compressed" : "dgc",
> "x-dtbncx+xml" : "ncx",
> "x-dtbook+xml" : "dtb",
> "x-dtbresource+xml" : "res",
> "x-eva" : "eva",
> "x-font-bdf" : "bdf",
> "x-font-ghostscript" : "gsf",
> "x-font-linux-psf" : "psf",
> "x-font-otf" : "otf",
> "x-font-pcf" : "pcf",
> "x-font-snf" : "snf",
> "x-font-ttf" : [ "ttf", "ttc" ],
> "x-font-type1" : [ "pfa", "pfb", "pfm", "afm" ],
> "x-font-woff" : "woff",
> "x-freearc" : "arc",
> "x-gca-compressed" : "gca",
> "x-glulx" : "ulx",
> "x-gramps-xml" : "gramps",
> "x-install-instructions" : "install",
> "x-lzh-compressed" : [ "lzh", "lha" ],
> "x-mie" : "mie",
> "x-mobipocket-ebook" : [ "prc", "mobi" ],
> "x-ms-application" : "application",
> "x-ms-shortcut" : "lnk",
> "x-ms-xbap" : "xbap",
> "x-msbinder" : "obd",
> "x-mscardfile" : "crd",
> "x-msclip" : "clp",
> "x-msdownload" : [ "exe", "dll", "com", "bat", "msi" ],
> "x-msmediaview" : [ "mvb", "m13", "m14" ],
> "x-msmetafile" : [ "wmf", "wmz", "emf", "emz" ],
> "x-msmoney" : "mny",
> "x-mspublisher" : "pub",
> "x-msschedule" : "scd",
> "x-msterminal" : "trm",
> "x-mswrite" : "wri",
> "x-nzb" : "nzb",
> "x-pkcs12" : [ "p12", "pfx" ],
> "x-pkcs7-certificates" : [ "p7b", "spc" ],
> "x-research-info-systems" : "ris",
> "x-silverlight-app" : "xap",
> "x-sql" : "sql",
> "x-stuffitx" : "sitx",
> "x-subrip" : "srt",
> "x-t3vm-image" : "t3",
> "x-tads" : "gam",
> "x-tex" : "tex",
> "x-tex-tfm" : "tfm",
> "x-tgif" : "obj",
> "x-xliff+xml" : "xlf",
> "x-xz" : "xz",
> "x-zmachine" : [ "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8" ],
> "xaml+xml" : "xaml",
> "xcap-diff+xml" : "xdf",
> "xenc+xml" : "xenc",
> "xml-dtd" : "dtd",
> "xop+xml" : "xop",
> "xproc+xml" : "xpl",
> "xslt+xml" : "xslt",
> "xv+xml" : [ "mxml", "xhvml", "xvml", "xvm" ],
> "yang" : "yang",
> "yin+xml" : "yin",
> "envoy" : "evy",
> "fractals" : "fif",
> "internet-property-stream" : "acx",
> "olescript" : "axs",
> "vnd.ms-outlook" : "msg",
> "vnd.ms-pkicertstore" : "sst",
> "x-compress" : "z",
> "x-compressed" : "tgz",
> "x-gzip" : "gz",
> "x-perfmon" : [ "pma", "pmc", "pml", "pmr", "pmw" ],
> "x-pkcs7-mime" : [ "p7c", "p7m" ],
> "ynd.ms-pkipko" : "pko"
> },
> "audio" : {
> "amr" : "amr",
> "amr-wb" : "awb",
> "annodex" : "axa",
> "basic" : [ "au", "snd" ],
> "flac" : "flac",
> "midi" : [ "mid", "midi", "kar", "rmi" ],
> "mpeg" : [ "mpga", "mpega", "mp2", "mp3", "m4a", "mp2a", "m2a", "m3a" ],
> "mpegurl" : "m3u",
> "ogg" : [ "oga", "ogg", "spx" ],
> "prs.sid" : "sid",
> "x-aiff" : [ "aif", "aiff", "aifc" ],
> "x-gsm" : "gsm",
> "x-ms-wma" : "wma",
> "x-ms-wax" : "wax",
> "x-pn-realaudio" : "ram",
> "x-realaudio" : "ra",
> "x-sd2" : "sd2",
> "x-wav" : "wav",
> "adpcm" : "adp",
> "mp4" : "mp4a",
> "s3m" : "s3m",
> "silk" : "sil",
> "vnd.dece.audio" : [ "uva", "uvva" ],
> "vnd.digital-winds" : "eol",
> "vnd.dra" : "dra",
> "vnd.dts" : "dts",
> "vnd.dts.hd" : "dtshd",
> "vnd.lucent.voice" : "lvp",
> "vnd.ms-playready.media.pya" : "pya",
> "vnd.nuera.ecelp4800" : "ecelp4800",
> "vnd.nuera.ecelp7470" : "ecelp7470",
> "vnd.nuera.ecelp9600" : "ecelp9600",
> "vnd.rip" : "rip",
> "webm" : "weba",
> "x-aac" : "aac",
> "x-caf" : "caf",
> "x-matroska" : "mka",
> "x-pn-realaudio-plugin" : "rmp",
> "xm" : "xm",
> "mid" : [ "mid", "rmi" ]
> },
> "chemical" : {
> "x-alchemy" : "alc",
> "x-cache" : [ "cac", "cache" ],
> "x-cache-csf" : "csf",
> "x-cactvs-binary" : [ "cbin", "cascii", "ctab" ],
> "x-cdx" : "cdx",
> "x-chem3d" : "c3d",
> "x-cif" : "cif",
> "x-cmdf" : "cmdf",
> "x-cml" : "cml",
> "x-compass" : "cpa",
> "x-crossfire" : "bsd",
> "x-csml" : [ "csml", "csm" ],
> "x-ctx" : "ctx",
> "x-cxf" : [ "cxf", "cef" ],
> "x-embl-dl-nucleotide" : [ "emb", "embl" ],
> "x-gamess-input" : [ "inp", "gam", "gamin" ],
> "x-gaussian-checkpoint" : [ "fch", "fchk" ],
> "x-gaussian-cube" : "cub",
> "x-gaussian-input" : [ "gau", "gjc", "gjf" ],
> "x-gaussian-log" : "gal",
> "x-gcg8-sequence" : "gcg",
> "x-genbank" : "gen",
> "x-hin" : "hin",
> "x-isostar" : [ "istr", "ist" ],
> "x-jcamp-dx" : [ "jdx", "dx" ],
> "x-kinemage" : "kin",
> "x-macmolecule" : "mcm",
> "x-macromodel-input" : [ "mmd", "mmod" ],
> "x-mdl-molfile" : "mol",
> "x-mdl-rdfile" : "rd",
> "x-mdl-rxnfile" : "rxn",
> "x-mdl-sdfile" : [ "sd", "sdf" ],
> "x-mdl-tgf" : "tgf",
> "x-mmcif" : "mcif",
> "x-mol2" : "mol2",
> "x-molconn-Z" : "b",
> "x-mopac-graph" : "gpt",
> "x-mopac-input" : [ "mop", "mopcrt", "mpc", "zmt" ],
> "x-mopac-out" : "moo",
> "x-ncbi-asn1" : "asn",
> "x-ncbi-asn1-ascii" : [ "prt", "ent" ],
> "x-ncbi-asn1-binary" : [ "val", "aso" ],
> "x-pdb" : [ "pdb", "ent" ],
> "x-rosdal" : "ros",
> "x-swissprot" : "sw",
> "x-vamas-iso14976" : "vms",
> "x-vmd" : "vmd",
> "x-xtel" : "xtel",
> "x-xyz" : "xyz"
> },
> "image" : {
> "gif" : "gif",
> "ief" : "ief",
> "jpeg" : [ "jpeg", "jpg", "jpe" ],
> "pcx" : "pcx",
> "png" : "png",
> "svg+xml" : [ "svg", "svgz" ],
> "tiff" : [ "tiff", "tif" ],
> "vnd.djvu" : [ "djvu", "djv" ],
> "vnd.wap.wbmp" : "wbmp",
> "x-canon-cr2" : "cr2",
> "x-canon-crw" : "crw",
> "x-cmu-raster" : "ras",
> "x-coreldraw" : "cdr",
> "x-coreldrawpattern" : "pat",
> "x-coreldrawtemplate" : "cdt",
> "x-corelphotopaint" : "cpt",
> "x-epson-erf" : "erf",
> "x-icon" : "ico",
> "x-jg" : "art",
> "x-jng" : "jng",
> "x-nikon-nef" : "nef",
> "x-olympus-orf" : "orf",
> "x-photoshop" : "psd",
> "x-portable-anymap" : "pnm",
> "x-portable-bitmap" : "pbm",
> "x-portable-graymap" : "pgm",
> "x-portable-pixmap" : "ppm",
> "x-rgb" : "rgb",
> "x-xbitmap" : "xbm",
> "x-xpixmap" : "xpm",
> "x-xwindowdump" : "xwd",
> "bmp" : "bmp",
> "cgm" : "cgm",
> "g3fax" : "g3",
> "ktx" : "ktx",
> "prs.btif" : "btif",
> "sgi" : "sgi",
> "vnd.dece.graphic" : [ "uvi", "uvvi", "uvg", "uvvg" ],
> "vnd.dwg" : "dwg",
> "vnd.dxf" : "dxf",
> "vnd.fastbidsheet" : "fbs",
> "vnd.fpx" : "fpx",
> "vnd.fst" : "fst",
> "vnd.fujixerox.edmics-mmr" : "mmr",
> "vnd.fujixerox.edmics-rlc" : "rlc",
> "vnd.ms-modi" : "mdi",
> "vnd.ms-photo" : "wdp",
> "vnd.net-fpx" : "npx",
> "vnd.xiff" : "xif",
> "webp" : "webp",
> "x-3ds" : "3ds",
> "x-cmx" : "cmx",
> "x-freehand" : [ "fh", "fhc", "fh4", "fh5", "fh7" ],
> "x-pict" : [ "pic", "pct" ],
> "x-tga" : "tga",
> "cis-cod" : "cod",
> "pipeg" : "jfif"
> },
> "message" : {
> "rfc822" : [ "eml", "mime", "mht", "mhtml", "nws" ]
> },
> "model" : {
> "iges" : [ "igs", "iges" ],
> "mesh" : [ "msh", "mesh", "silo" ],
> "vrml" : [ "wrl", "vrml" ],
> "x3d+vrml" : [ "x3dv", "x3dvz" ],
> "x3d+xml" : [ "x3d", "x3dz" ],
> "x3d+binary" : [ "x3db", "x3dbz" ],
> "vnd.collada+xml" : "dae",
> "vnd.dwf" : "dwf",
> "vnd.gdl" : "gdl",
> "vnd.gtw" : "gtw",
> "vnd.mts" : "mts",
> "vnd.vtu" : "vtu"
> },
> "text" : {
> "cache-manifest" : [ "manifest", "appcache" ],
> "calendar" : [ "ics", "icz", "ifb" ],
> "css" : "css",
> "csv" : "csv",
> "h323" : "323",
> "html" : [ "html", "htm", "shtml", "stm" ],
> "iuls" : "uls",
> "mathml" : "mml",
> "plain" : [ "txt", "text", "brf", "conf", "def", "list", "log", "in", "bas" ],
> "richtext" : "rtx",
> "scriptlet" : [ "sct", "wsc" ],
> "texmacs" : [ "tm", "ts" ],
> "tab-separated-values" : "tsv",
> "vnd.sun.j2me.app-descriptor" : "jad",
> "vnd.wap.wml" : "wml",
> "vnd.wap.wmlscript" : "wmls",
> "x-bibtex" : "bib",
> "x-boo" : "boo",
> "x-c++hdr" : [ "h++", "hpp", "hxx", "hh" ],
> "x-c++src" : [ "c++", "cpp", "cxx", "cc" ],
> "x-component" : "htc",
> "x-dsrc" : "d",
> "x-diff" : [ "diff", "patch" ],
> "x-haskell" : "hs",
> "x-java" : "java",
> "x-literate-haskell" : "lhs",
> "x-moc" : "moc",
> "x-pascal" : [ "p", "pas" ],
> "x-pcs-gcd" : "gcd",
> "x-perl" : [ "pl", "pm" ],
> "x-python" : "py",
> "x-scala" : "scala",
> "x-setext" : "etx",
> "x-tcl" : [ "tcl", "tk" ],
> "x-tex" : [ "tex", "ltx", "sty", "cls" ],
> "x-vcalendar" : "vcs",
> "x-vcard" : "vcf",
> "n3" : "n3",
> "prs.lines.tag" : "dsc",
> "sgml" : [ "sgml", "sgm" ],
> "troff" : [ "t", "tr", "roff", "man", "me", "ms" ],
> "turtle" : "ttl",
> "uri-list" : [ "uri", "uris", "urls" ],
> "vcard" : "vcard",
> "vnd.curl" : "curl",
> "vnd.curl.dcurl" : "dcurl",
> "vnd.curl.scurl" : "scurl",
> "vnd.curl.mcurl" : "mcurl",
> "vnd.dvb.subtitle" : "sub",
> "vnd.fly" : "fly",
> "vnd.fmi.flexstor" : "flx",
> "vnd.graphviz" : "gv",
> "vnd.in3d.3dml" : "3dml",
> "vnd.in3d.spot" : "spot",
> "x-asm" : [ "s", "asm" ],
> "x-c" : [ "c", "cc", "cxx", "cpp", "h", "hh", "dic" ],
> "x-fortran" : [ "f", "for", "f77", "f90" ],
> "x-opml" : "opml",
> "x-nfo" : "nfo",
> "x-sfv" : "sfv",
> "x-uuencode" : "uu",
> "webviewhtml" : "htt"
> },
> "video" : {
> "3gpp" : "3gp",
> "annodex" : "axv",
> "dl" : "dl",
> "dv" : [ "dif", "dv" ],
> "fli" : "fli",
> "gl" : "gl",
> "mpeg" : [ "mpeg", "mpg", "mpe", "m1v", "m2v", "mp2", "mpa", "mpv2" ],
> "mp4" : [ "mp4", "mp4v", "mpg4" ],
> "quicktime" : [ "qt", "mov" ],
> "ogg" : "ogv",
> "vnd.mpegurl" : [ "mxu", "m4u" ],
> "x-flv" : "flv",
> "x-la-asf" : [ "lsf", "lsx" ],
> "x-mng" : "mng",
> "x-ms-asf" : [ "asf", "asx", "asr" ],
> "x-ms-wm" : "wm",
> "x-ms-wmv" : "wmv",
> "x-ms-wmx" : "wmx",
> "x-ms-wvx" : "wvx",
> "x-msvideo" : "avi",
> "x-sgi-movie" : "movie",
> "x-matroska" : [ "mpv", "mkv", "mk3d", "mks" ],
> "3gpp2" : "3g2",
> "h261" : "h261",
> "h263" : "h263",
> "h264" : "h264",
> "jpeg" : "jpgv",
> "jpm" : [ "jpm", "jpgm" ],
> "mj2" : [ "mj2", "mjp2" ],
> "vnd.dece.hd" : [ "uvh", "uvvh" ],
> "vnd.dece.mobile" : [ "uvm", "uvvm" ],
> "vnd.dece.pd" : [ "uvp", "uvvp" ],
> "vnd.dece.sd" : [ "uvs", "uvvs" ],
> "vnd.dece.video" : [ "uvv", "uvvv" ],
> "vnd.dvb.file" : "dvb",
> "vnd.fvt" : "fvt",
> "vnd.ms-playready.media.pyv" : "pyv",
> "vnd.uvvu.mp4" : [ "uvu", "uvvu" ],
> "vnd.vivo" : "viv",
> "webm" : "webm",
> "x-f4v" : "f4v",
> "x-m4v" : "m4v",
> "x-ms-vob" : "vob",
> "x-smv" : "smv"
> },
> "x-conference" : {
> "x-cooltalk" : "ice"
> },
> "x-world" : {
> "x-vrml" : [ "vrm", "vrml", "wrl", "flr", "wrz", "xaf", "xof" ]
> }
> };
>
> var mimeTypes = (function() {
> var type, subtype, val, index, mimeTypes = {};
> for (type in table) {
> if (table.hasOwnProperty(type)) {
> for (subtype in table[type]) {
> if (table[type].hasOwnProperty(subtype)) {
> val = table[type][subtype];
> if (typeof val == "string") {
> mimeTypes[val] = type + "/" + subtype;
> } else {
> for (index = 0; index < val.length; index++) {
> mimeTypes[val[index]] = type + "/" + subtype;
> }
> }
> }
> }
> }
> }
> return mimeTypes;
> })();
>
> zip.getMimeType = function(filename) {
> var defaultValue = "application/octet-stream";
> return filename && mimeTypes[filename.split(".").pop().toLowerCase()] || defaultValue;
> };
>
> })();
>
> define("mime-types", ["zip"], (function (global) {
> return function () {
> var ret, fn;
> return ret || global.zip;
> };
> }(this)));
>
> /*
> Copyright (c) 2013 Gildas Lormeau. All rights reserved.
>
> Redistribution and use in source and binary forms, with or without
> modification, are permitted provided that the following conditions are met:
>
> 1. Redistributions of source code must retain the above copyright notice,
> this list of conditions and the following disclaimer.
>
> 2. Redistributions in binary form must reproduce the above copyright
> notice, this list of conditions and the following disclaimer in
> the documentation and/or other materials provided with the distribution.
>
> 3. The names of the authors may not be used to endorse or promote products
> derived from this software without specific prior written permission.
>
> THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
> INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
> FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
> INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
> INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
> OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
> LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
> EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> */
>
> (function() {
> "use strict";
>
> var CHUNK_SIZE = 512 * 1024;
>
> var TextWriter = zip.TextWriter, //
> BlobWriter = zip.BlobWriter, //
> Data64URIWriter = zip.Data64URIWriter, //
> Reader = zip.Reader, //
> TextReader = zip.TextReader, //
> BlobReader = zip.BlobReader, //
> Data64URIReader = zip.Data64URIReader, //
> createReader = zip.createReader, //
> createWriter = zip.createWriter;
>
> function ZipBlobReader(entry) {
> var that = this, blobReader;
>
> function init(callback) {
> that.size = entry.uncompressedSize;
> callback();
> }
>
> function getData(callback) {
> if (that.data)
> callback();
> else
> entry.getData(new BlobWriter(), function(data) {
> that.data = data;
> blobReader = new BlobReader(data);
> callback();
> }, null, that.checkCrc32);
> }
>
> function readUint8Array(index, length, callback, onerror) {
> getData(function() {
> blobReader.readUint8Array(index, length, callback, onerror);
> }, onerror);
> }
>
> that.size = 0;
> that.init = init;
> that.readUint8Array = readUint8Array;
> }
> ZipBlobReader.prototype = new Reader();
> ZipBlobReader.prototype.constructor = ZipBlobReader;
> ZipBlobReader.prototype.checkCrc32 = false;
>
> function getTotalSize(entry) {
> var size = 0;
>
> function process(entry) {
> size += entry.uncompressedSize || 0;
> entry.children.forEach(process);
> }
>
> process(entry);
> return size;
> }
>
> function initReaders(entry, onend, onerror) {
> var index = 0;
>
> function next() {
> index++;
> if (index < entry.children.length)
> process(entry.children[index]);
> else
> onend();
> }
>
> function process(child) {
> if (child.directory)
> initReaders(child, next, onerror);
> else {
> child.reader = new child.Reader(child.data, onerror);
> child.reader.init(function() {
> child.uncompressedSize = child.reader.size;
> next();
> });
> }
> }
>
> if (entry.children.length)
> process(entry.children[index]);
> else
> onend();
> }
>
> function detach(entry) {
> var children = entry.parent.children;
> children.forEach(function(child, index) {
> if (child.id == entry.id)
> children.splice(index, 1);
> });
> }
>
> function exportZip(zipWriter, entry, onend, onprogress, totalSize) {
> var currentIndex = 0;
>
> function process(zipWriter, entry, onend, onprogress, totalSize) {
> var childIndex = 0;
>
> function exportChild() {
> var child = entry.children[childIndex];
> if (child)
> zipWriter.add(child.getFullname(), child.reader, function() {
> currentIndex += child.uncompressedSize || 0;
> process(zipWriter, child, function() {
> childIndex++;
> exportChild();
> }, onprogress, totalSize);
> }, function(index) {
> if (onprogress)
> onprogress(currentIndex + index, totalSize);
> }, {
> directory : child.directory,
> version : child.zipVersion
> });
> else
> onend();
> }
>
> exportChild();
> }
>
> process(zipWriter, entry, onend, onprogress, totalSize);
> }
>
> function addFileEntry(zipEntry, fileEntry, onend, onerror) {
> function getChildren(fileEntry, callback) {
> var entries = [];
> if (fileEntry.isDirectory) {
> var directoryReader = fileEntry.createReader();
> (function readEntries() {
> directoryReader.readEntries(function(temporaryEntries) {
> if (!temporaryEntries.length)
> callback(entries);
> else {
> entries = entries.concat(temporaryEntries);
> readEntries();
> }
> }, onerror);
> })();
> }
> if (fileEntry.isFile)
> callback(entries);
> }
>
> function process(zipEntry, fileEntry, onend) {
> getChildren(fileEntry, function(children) {
> var childIndex = 0;
>
> function addChild(child) {
> function nextChild(childFileEntry) {
> process(childFileEntry, child, function() {
> childIndex++;
> processChild();
> });
> }
>
> if (child.isDirectory)
> nextChild(zipEntry.addDirectory(child.name));
> if (child.isFile)
> child.file(function(file) {
> var childZipEntry = zipEntry.addBlob(child.name, file);
> childZipEntry.uncompressedSize = file.size;
> nextChild(childZipEntry);
> }, onerror);
> }
>
> function processChild() {
> var child = children[childIndex];
> if (child)
> addChild(child);
> else
> onend();
> }
>
> processChild();
> });
> }
>
> if (fileEntry.isDirectory)
> process(zipEntry, fileEntry, onend);
> else
> fileEntry.file(function(file) {
> zipEntry.addBlob(fileEntry.name, file);
> onend();
> }, onerror);
> }
>
> function getFileEntry(fileEntry, entry, onend, onprogress, onerror, totalSize, checkCrc32) {
> var currentIndex = 0;
>
> function process(fileEntry, entry, onend, onprogress, onerror, totalSize) {
> var childIndex = 0;
>
> function addChild(child) {
> function nextChild(childFileEntry) {
> currentIndex += child.uncompressedSize || 0;
> process(childFileEntry, child, function() {
> childIndex++;
> processChild();
> }, onprogress, onerror, totalSize);
> }
>
> if (child.directory)
> fileEntry.getDirectory(child.name, {
> create : true
> }, nextChild, onerror);
> else
> fileEntry.getFile(child.name, {
> create : true
> }, function(file) {
> child.getData(new zip.FileWriter(file, zip.getMimeType(child.name)), nextChild, function(index) {
> if (onprogress)
> onprogress(currentIndex + index, totalSize);
> }, checkCrc32);
> }, onerror);
> }
>
> function processChild() {
> var child = entry.children[childIndex];
> if (child)
> addChild(child);
> else
> onend();
> }
>
> processChild();
> }
>
> if (entry.directory)
> process(fileEntry, entry, onend, onprogress, onerror, totalSize);
> else
> entry.getData(new zip.FileWriter(fileEntry, zip.getMimeType(entry.name)), onend, onprogress, checkCrc32);
> }
>
> function resetFS(fs) {
> fs.entries = [];
> fs.root = new ZipDirectoryEntry(fs);
> }
>
> function bufferedCopy(reader, writer, onend, onprogress, onerror) {
> var chunkIndex = 0;
>
> function stepCopy() {
> var index = chunkIndex * CHUNK_SIZE;
> if (onprogress)
> onprogress(index, reader.size);
> if (index < reader.size)
> reader.readUint8Array(index, Math.min(CHUNK_SIZE, reader.size - index), function(array) {
> writer.writeUint8Array(new Uint8Array(array), function() {
> chunkIndex++;
> stepCopy();
> });
> }, onerror);
> else
> writer.getData(onend);
> }
>
> stepCopy();
> }
>
> function addChild(parent, name, params, directory) {
> if (parent.directory)
> return directory ? new ZipDirectoryEntry(parent.fs, name, params, parent) : new ZipFileEntry(parent.fs, name, params, parent);
> else
> throw "Parent entry is not a directory.";
> }
>
> function ZipEntry() {
> }
>
> ZipEntry.prototype = {
> init : function(fs, name, params, parent) {
> var that = this;
> if (fs.root && parent && parent.getChildByName(name))
> throw "Entry filename already exists.";
> if (!params)
> params = {};
> that.fs = fs;
> that.name = name;
> that.id = fs.entries.length;
> that.parent = parent;
> that.children = [];
> that.zipVersion = params.zipVersion || 0x14;
> that.uncompressedSize = 0;
> fs.entries.push(that);
> if (parent)
> that.parent.children.push(that);
> },
> getFileEntry : function(fileEntry, onend, onprogress, onerror, checkCrc32) {
> var that = this;
> initReaders(that, function() {
> getFileEntry(fileEntry, that, onend, onprogress, onerror, getTotalSize(that), checkCrc32);
> }, onerror);
> },
> moveTo : function(target) {
> var that = this;
> if (target.directory) {
> if (!target.isDescendantOf(that)) {
> if (that != target) {
> if (target.getChildByName(that.name))
> throw "Entry filename already exists.";
> detach(that);
> that.parent = target;
> target.children.push(that);
> }
> } else
> throw "Entry is a ancestor of target entry.";
> } else
> throw "Target entry is not a directory.";
> },
> getFullname : function() {
> var that = this, fullname = that.name, entry = that.parent;
> while (entry) {
> fullname = (entry.name ? entry.name + "/" : "") + fullname;
> entry = entry.parent;
> }
> return fullname;
> },
> isDescendantOf : function(ancestor) {
> var entry = this.parent;
> while (entry && entry.id != ancestor.id)
> entry = entry.parent;
> return !!entry;
> }
> };
> ZipEntry.prototype.constructor = ZipEntry;
>
> var ZipFileEntryProto;
>
> function ZipFileEntry(fs, name, params, parent) {
> var that = this;
> ZipEntry.prototype.init.call(that, fs, name, params, parent);
> that.Reader = params.Reader;
> that.Writer = params.Writer;
> that.data = params.data;
> if (params.getData) {
> that.getData = params.getData;
> }
> }
>
> ZipFileEntry.prototype = ZipFileEntryProto = new ZipEntry();
> ZipFileEntryProto.constructor = ZipFileEntry;
> ZipFileEntryProto.getData = function(writer, onend, onprogress, onerror) {
> var that = this;
> if (!writer || (writer.constructor == that.Writer && that.data))
> onend(that.data);
> else {
> if (!that.reader)
> that.reader = new that.Reader(that.data, onerror);
> that.reader.init(function() {
> writer.init(function() {
> bufferedCopy(that.reader, writer, onend, onprogress, onerror);
> }, onerror);
> });
> }
> };
>
> ZipFileEntryProto.getText = function(onend, onprogress, checkCrc32, encoding) {
> this.getData(new TextWriter(encoding), onend, onprogress, checkCrc32);
> };
> ZipFileEntryProto.getBlob = function(mimeType, onend, onprogress, checkCrc32) {
> this.getData(new BlobWriter(mimeType), onend, onprogress, checkCrc32);
> };
> ZipFileEntryProto.getData64URI = function(mimeType, onend, onprogress, checkCrc32) {
> this.getData(new Data64URIWriter(mimeType), onend, onprogress, checkCrc32);
> };
>
> var ZipDirectoryEntryProto;
>
> function ZipDirectoryEntry(fs, name, params, parent) {
> var that = this;
> ZipEntry.prototype.init.call(that, fs, name, params, parent);
> that.directory = true;
> }
>
> ZipDirectoryEntry.prototype = ZipDirectoryEntryProto = new ZipEntry();
> ZipDirectoryEntryProto.constructor = ZipDirectoryEntry;
> ZipDirectoryEntryProto.addDirectory = function(name) {
> return addChild(this, name, null, true);
> };
> ZipDirectoryEntryProto.addText = function(name, text) {
> return addChild(this, name, {
> data : text,
> Reader : TextReader,
> Writer : TextWriter
> });
> };
> ZipDirectoryEntryProto.addBlob = function(name, blob) {
> return addChild(this, name, {
> data : blob,
> Reader : BlobReader,
> Writer : BlobWriter
> });
> };
> ZipDirectoryEntryProto.addData64URI = function(name, dataURI) {
> return addChild(this, name, {
> data : dataURI,
> Reader : Data64URIReader,
> Writer : Data64URIWriter
> });
> };
> ZipDirectoryEntryProto.addFileEntry = function(fileEntry, onend, onerror) {
> addFileEntry(this, fileEntry, onend, onerror);
> };
> ZipDirectoryEntryProto.addData = function(name, params) {
> return addChild(this, name, params);
> };
> ZipDirectoryEntryProto.importBlob = function(blob, onend, onerror) {
> this.importZip(new BlobReader(blob), onend, onerror);
> };
> ZipDirectoryEntryProto.importText = function(text, onend, onerror) {
> this.importZip(new TextReader(text), onend, onerror);
> };
> ZipDirectoryEntryProto.importData64URI = function(dataURI, onend, onerror) {
> this.importZip(new Data64URIReader(dataURI), onend, onerror);
> };
> ZipDirectoryEntryProto.exportBlob = function(onend, onprogress, onerror) {
> this.exportZip(new BlobWriter("application/zip"), onend, onprogress, onerror);
> };
> ZipDirectoryEntryProto.exportText = function(onend, onprogress, onerror) {
> this.exportZip(new TextWriter(), onend, onprogress, onerror);
> };
> ZipDirectoryEntryProto.exportFileEntry = function(fileEntry, onend, onprogress, onerror) {
> this.exportZip(new zip.FileWriter(fileEntryz), onend, onprogress, onerror);
> };
> ZipDirectoryEntryProto.exportData64URI = function(onend, onprogress, onerror) {
> this.exportZip(new Data64URIWriter("application/zip"), onend, onprogress, onerror);
> };
> ZipDirectoryEntryProto.importZip = function(reader, onend, onerror) {
> var that = this;
> createReader(reader, function(zipReader) {
> zipReader.getEntries(function(entries) {
> entries.forEach(function(entry) {
> var parent = that, path = entry.filename.split("/"), name = path.pop();
> path.forEach(function(pathPart) {
> parent = parent.getChildByName(pathPart) || new ZipDirectoryEntry(that.fs, pathPart, null, parent);
> });
> if (!entry.directory)
> addChild(parent, name, {
> data : entry,
> Reader : ZipBlobReader
> });
> });
> onend();
> });
> }, onerror);
> };
> ZipDirectoryEntryProto.exportZip = function(writer, onend, onprogress, onerror) {
> var that = this;
> initReaders(that, function() {
> createWriter(writer, function(zipWriter) {
> exportZip(zipWriter, that, function() {
> zipWriter.close(onend);
> }, onprogress, getTotalSize(that));
> }, onerror);
> }, onerror);
> };
> ZipDirectoryEntryProto.getChildByName = function(name) {
> var childIndex, child, that = this;
> for (childIndex = 0; childIndex < that.children.length; childIndex++) {
> child = that.children[childIndex];
> if (child.name == name)
> return child;
> }
> };
>
> function FS() {
> resetFS(this);
> }
> FS.prototype = {
> remove : function(entry) {
> detach(entry);
> this.entries[entry.id] = null;
> },
> find : function(fullname) {
> var index, path = fullname.split("/"), node = this.root;
> for (index = 0; node && index < path.length; index++)
> node = node.getChildByName(path[index]);
> return node;
> },
> getById : function(id) {
> return this.entries[id];
> },
> importBlob : function(blob, onend, onerror) {
> resetFS(this);
> this.root.importBlob(blob, onend, onerror);
> },
> importText : function(text, onend, onerror) {
> resetFS(this);
> this.root.importText(text, onend, onerror);
> },
> importData64URI : function(dataURI, onend, onerror) {
> resetFS(this);
> this.root.importData64URI(dataURI, onend, onerror);
> },
> exportBlob : function(onend, onprogress, onerror) {
> this.root.exportBlob(onend, onprogress, onerror);
> },
> exportText : function(onend, onprogress, onerror) {
> this.root.exportText(onend, onprogress, onerror);
> },
> exportFileEntry : function(fileEntry, onend, onprogress, onerror) {
> this.root.exportFileEntry(fileEntry, onend, onprogress, onerror);
> },
> exportData64URI : function(onend, onprogress, onerror) {
> this.root.exportData64URI(onend, onprogress, onerror);
> }
> };
>
> zip.fs = {
> FS : FS,
> ZipDirectoryEntry : ZipDirectoryEntry,
> ZipFileEntry : ZipFileEntry
> };
>
> zip.getMimeType = function() {
> return "application/octet-stream";
> };
>
> })();
>
> define("zip-fs", ["mime-types"], (function (global) {
> return function () {
> var ret, fn;
> return ret || global.zip;
> };
> }(this)));
>
> /*
> Copyright (c) 2013 Gildas Lormeau. All rights reserved.
>
> Redistribution and use in source and binary forms, with or without
> modification, are permitted provided that the following conditions are met:
>
> 1. Redistributions of source code must retain the above copyright notice,
> this list of conditions and the following disclaimer.
>
> 2. Redistributions in binary form must reproduce the above copyright
> notice, this list of conditions and the following disclaimer in
> the documentation and/or other materials provided with the distribution.
>
> 3. The names of the authors may not be used to endorse or promote products
> derived from this software without specific prior written permission.
>
> THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
> INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
> FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
> INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
> INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
> OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
> LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
> EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> */
>
> (function() {
> "use strict";
>
> var ERR_HTTP_RANGE = "HTTP Range not supported.";
>
> var Reader = zip.Reader;
> var Writer = zip.Writer;
>
> var ZipDirectoryEntry;
>
> var appendABViewSupported;
> try {
> appendABViewSupported = new Blob([ new DataView(new ArrayBuffer(0)) ]).size === 0;
> } catch (e) {
> }
>
> function isHttpFamily(url) {
> var a = document.createElement("a");
> a.href = url;
> return a.protocol === "http:" || a.protocol === "https:";
> }
>
> function HttpReader(url) {
> var that = this;
>
> function getData(callback, onerror) {
> var request;
> if (!that.data) {
> request = new XMLHttpRequest();
> request.addEventListener("load", function() {
> if (!that.size)
> that.size = Number(request.getResponseHeader("Content-Length")) || Number(request.response.byteLength);
> that.data = new Uint8Array(request.response);
> callback();
> }, false);
> request.addEventListener("error", onerror, false);
> request.open("GET", url);
> request.responseType = "arraybuffer";
> request.send();
> } else
> callback();
> }
>
> function init(callback, onerror) {
> if (!isHttpFamily(url)) {
> // For schemas other than http(s), HTTP HEAD may be unavailable,
> // so use HTTP GET instead.
> getData(callback, onerror);
> return;
> }
> var request = new XMLHttpRequest();
> request.addEventListener("load", function() {
> that.size = Number(request.getResponseHeader("Content-Length"));
> // If response header doesn't return size then prefetch the content.
> if (!that.size) {
> getData(callback, onerror);
> } else {
> callback();
> }
> }, false);
> request.addEventListener("error", onerror, false);
> request.open("HEAD", url);
> request.send();
> }
>
> function readUint8Array(index, length, callback, onerror) {
> getData(function() {
> callback(new Uint8Array(that.data.subarray(index, index + length)));
> }, onerror);
> }
>
> that.size = 0;
> that.init = init;
> that.readUint8Array = readUint8Array;
> }
> HttpReader.prototype = new Reader();
> HttpReader.prototype.constructor = HttpReader;
>
> function HttpRangeReader(url) {
> var that = this;
>
> function init(callback, onerror) {
> var request = new XMLHttpRequest();
> request.addEventListener("load", function() {
> that.size = Number(request.getResponseHeader("Content-Length"));
>
> // Some HTTP servers do not emit the Accept-Ranges header :(
> if (true || request.getResponseHeader("Accept-Ranges") == "bytes")
> callback();
> else
> onerror(ERR_HTTP_RANGE);
> }, false);
> request.addEventListener("error", onerror, false);
> request.open("HEAD", url);
> request.send();
> }
>
> function readArrayBuffer(index, length, callback, onerror) {
> var request = new XMLHttpRequest();
> request.open("GET", url);
> request.responseType = "arraybuffer";
> request.setRequestHeader("Range", "bytes=" + index + "-" + (index + length - 1));
> request.addEventListener("load", function() {
> callback(request.response);
> }, false);
> request.addEventListener("error", onerror, false);
> request.send();
> }
>
> function readUint8Array(index, length, callback, onerror) {
> readArrayBuffer(index, length, function(arraybuffer) {
> callback(new Uint8Array(arraybuffer));
> }, onerror);
> }
>
> that.size = 0;
> that.init = init;
> that.readUint8Array = readUint8Array;
> }
> HttpRangeReader.prototype = new Reader();
> HttpRangeReader.prototype.constructor = HttpRangeReader;
>
> function ArrayBufferReader(arrayBuffer) {
> var that = this;
>
> function init(callback, onerror) {
> that.size = arrayBuffer.byteLength;
> callback();
> }
>
> function readUint8Array(index, length, callback, onerror) {
> callback(new Uint8Array(arrayBuffer.slice(index, index + length)));
> }
>
> that.size = 0;
> that.init = init;
> that.readUint8Array = readUint8Array;
> }
> ArrayBufferReader.prototype = new Reader();
> ArrayBufferReader.prototype.constructor = ArrayBufferReader;
>
> function ArrayBufferWriter() {
> var array, that = this;
>
> function init(callback, onerror) {
> array = new Uint8Array();
> callback();
> }
>
> function writeUint8Array(arr, callback, onerror) {
> var tmpArray = new Uint8Array(array.length + arr.length);
> tmpArray.set(array);
> tmpArray.set(arr, array.length);
> array = tmpArray;
> callback();
> }
>
> function getData(callback) {
> callback(array.buffer);
> }
>
> that.init = init;
> that.writeUint8Array = writeUint8Array;
> that.getData = getData;
> }
> ArrayBufferWriter.prototype = new Writer();
> ArrayBufferWriter.prototype.constructor = ArrayBufferWriter;
>
> function FileWriter(fileEntry, contentType) {
> var writer, that = this;
>
> function init(callback, onerror) {
> fileEntry.createWriter(function(fileWriter) {
> writer = fileWriter;
> callback();
> }, onerror);
> }
>
> function writeUint8Array(array, callback, onerror) {
> var blob = new Blob([ appendABViewSupported ? array : array.buffer ], {
> type : contentType
> });
> writer.onwrite = function() {
> writer.onwrite = null;
> callback();
> };
> writer.onerror = onerror;
> writer.write(blob);
> }
>
> function getData(callback) {
> fileEntry.file(callback);
> }
>
> that.init = init;
> that.writeUint8Array = writeUint8Array;
> that.getData = getData;
> }
> FileWriter.prototype = new Writer();
> FileWriter.prototype.constructor = FileWriter;
>
> zip.FileWriter = FileWriter;
> zip.HttpReader = HttpReader;
> zip.HttpRangeReader = HttpRangeReader;
> zip.ArrayBufferReader = ArrayBufferReader;
> zip.ArrayBufferWriter = ArrayBufferWriter;
>
> if (zip.fs) {
> ZipDirectoryEntry = zip.fs.ZipDirectoryEntry;
> ZipDirectoryEntry.prototype.addHttpContent = function(name, URL, useRangeHeader) {
> function addChild(parent, name, params, directory) {
> if (parent.directory)
> return directory ? new ZipDirectoryEntry(parent.fs, name, params, parent) : new zip.fs.ZipFileEntry(parent.fs, name, params, parent);
> else
> throw "Parent entry is not a directory.";
> }
>
> return addChild(this, name, {
> data : URL,
> Reader : useRangeHeader ? HttpRangeReader : HttpReader
> });
> };
> ZipDirectoryEntry.prototype.importHttpContent = function(URL, useRangeHeader, onend, onerror) {
> this.importZip(useRangeHeader ? new HttpRangeReader(URL) : new HttpReader(URL), onend, onerror);
> };
> zip.fs.FS.prototype.importHttpContent = function(URL, useRangeHeader, onend, onerror) {
> this.entries = [];
> this.root = new ZipDirectoryEntry(this);
> this.root.importHttpContent(URL, useRangeHeader, onend, onerror);
> };
> }
>
> })();
>
> define("zip-ext", ["zip-fs"], (function (global) {
> return function () {
> var ret, fn;
> return ret || global.zip;
> };
> }(this)));
>
> /*
> Copyright (c) 2013 Gildas Lormeau. All rights reserved.
>
> Redistribution and use in source and binary forms, with or without
> modification, are permitted provided that the following conditions are met:
>
> 1. Redistributions of source code must retain the above copyright notice,
> this list of conditions and the following disclaimer.
>
> 2. Redistributions in binary form must reproduce the above copyright
> notice, this list of conditions and the following disclaimer in
> the documentation and/or other materials provided with the distribution.
>
> 3. The names of the authors may not be used to endorse or promote products
> derived from this software without specific prior written permission.
>
> THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
> INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
> FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
> INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
> INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
> OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
> LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
> EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> */
>
5592c7439,7559
< }
---
> },
> exportAllZip : function (callbacks) {
>
> let _markup = "";
> const processFSEntry = (zipWriter, level, arr, i, next) => {
> const fsEntry = arr[i];
>
> if (fsEntry.isFile) {
> if (fsEntry.name == "readium-db.zip") {
> next(i);
> } else {
> fsEntry.file((f) => {
> const pt = fsEntry.fullPath.startsWith("/") ? fsEntry.fullPath.substring(1) : fsEntry.fullPath;
>
> _markup += `<p><span style="font-weight: bold;">${pt}</span> (${f.size})</p>`; // [${fsEntry.name}] (${level}.${i})
>
> // return next(i);
>
> let r;
> try {
> r = new zip.BlobReader(f);
> } catch (e) {
> _markup = "?????" + _markup;
> return next(i);
> }
> // return next(i);
>
> zipWriter.add(
> // (s) => {
> // _markup = s + "!!!!" + _markup;
> // return next(i);
> // },
> pt,
> r,
> () => {
> next(i);
> },
> () => {
> // progress
> },
> {directory: false, level: 0});
>
> // const fileReader = new FileReader();
> // fileReader.onloadend = (err) => {
> // _markup += `<p><span style="font-weight: bold;">${fsEntry.fullPath}</span> (${f.size} || ${fileReader.result ? fileReader.result.byteLength : err})</p>`; // [${fsEntry.name}] (${level}.${i})
> // next(i);
> // }
> // fileReader.readAsArrayBuffer(f); // readAsBinaryString() readAsDataURL() readAsText()
> });
> }
> } else if (fsEntry.isDirectory) {
> // return next(i);
>
> zipWriter.add(fsEntry.fullPath.startsWith("/") ? fsEntry.fullPath.substring(1) : fsEntry.fullPath, null, () => {
>
> recurseFS(zipWriter, fsEntry, level + 1, () => {
> next(i);
> });
> }, null, {directory: true});
>
> }
> };
> const readFSEntries = (zipWriter, fsEntry, fsReader, level, readFSEntriesDone) => {
>
> fsReader.readEntries((res) => {
>
> if (!res.length) {
> readFSEntriesDone();
> return;
> }
>
> // Array.prototype.slice.call(res, 0)
> const arr = Array.from(res);
> const next = (i) => {
> if (i+1 < arr.length) {
> processFSEntry(zipWriter, level, arr, i+1, next);
> } else {
> readFSEntries(zipWriter, fsEntry, fsReader, level, readFSEntriesDone);
> }
> };
> processFSEntry(zipWriter, level, arr, 0, next);
> }, (e) => {
> callbacks.error(JSON.stringify(e));
> });
> };
> const recurseFS = (zipWriter, fsEntry, level, recurseFSDone) => {
>
> const fsReader = fsEntry.createReader();
>
> readFSEntries(zipWriter, fsEntry, fsReader, level, () => {
> recurseFSDone();
> });
> };
>
> const go = (zipWriter) => {
>
> recurseFS(zipWriter, StorageManager.getRootDir(), 0, () => {
> zipWriter.close(() => {
> callbacks.success(_markup);
> }, (err) => {
> callbacks.error(JSON.stringify(err));
> });
> });
> };
>
> // fs.root
> StorageManager.getRootDir().getFile("readium-db.zip", {create:true}, (fileEntry) => {
>
> zip.createWriter(
> new zip.FileWriter(fileEntry, "application/zip"),
> (zipWriter) => {
> go(zipWriter);
> }, (err) => {
> callbacks.error(JSON.stringify(err));
> }); // new zip.ZipWriter()
>
>
> }, (err) => {
> callbacks.error(JSON.stringify(err));
> });
> }
5665a7633,7639
>
> case "EXPORT_ALL_ZIP":
> StorageManager.initStorage(function(){
> writer.exportAllZip({success: (markup) => { writer.libraryData = markup; success(); }, progress: progress, error: error, overwrite: overwrite});
> }, error);
> break;
> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
ONLY USE THIS METHOD AS LAST RESORT, THIS IS QUITE TECHNICAL AND MAY CAUSE LOSS OF DATA IN YOUR INSTALLED READIUM CHROME APP
chrome://extensions
.fepbnnnkkadjhjahcafoaglimekefifl
).C:\Users\USERNAME\AppData\Local\Google\Chrome\User Data\Default\Extensions
. On Mac this should be/Users/USERNAME/Library/Application Support/Google/Chrome/Default/Extensions/
(make sure to replaceUSERNAME
with your system / login name). On Linux: TBD.fepbnnnkkadjhjahcafoaglimekefifl
).2.31.1_0
, and move into thescripts
folder which must contain a small file namedreadium-js-viewer_CHROMEAPP-WORKER.js
(just under 180KB) and a larger file namedreadium-js-viewer_all_CHROMEAPP.js
(2.5MB)fepbnnnkkadjhjahcafoaglimekefifl
)chrome://apps
.11) You may now restore the two original files `readium-js-viewer_CHROMEAPP-WORKER.js` and `readium-js-viewer_all_CHROMEAPP.js` which were copied in a previous step.
Beta Was this translation helpful? Give feedback.
All reactions