├── LICENSE ├── README.md ├── blocks.md ├── sb2-tool ├── README.md └── sb2_to_cpp.py └── web └── crx ├── README.md ├── icon.png ├── icon.xcf ├── icon128.png ├── icon16.png ├── icon48.png ├── lib ├── Stuk-jszip-9fb481a │ ├── .codeclimate.yml │ ├── .editorconfig │ ├── .gitignore │ ├── .jshintignore │ ├── .jshintrc │ ├── .npmignore │ ├── .travis.yml │ ├── CHANGES.md │ ├── Gruntfile.js │ ├── LICENSE.markdown │ ├── README.markdown │ ├── _config.yml │ ├── bower.json │ ├── component.json │ ├── dist │ │ ├── jszip.js │ │ └── jszip.min.js │ ├── docs │ │ ├── APPNOTE.TXT │ │ ├── ZIP spec.txt │ │ └── references.txt │ ├── documentation │ │ ├── _layouts │ │ │ └── default.html │ │ ├── api_jszip.md │ │ ├── api_jszip │ │ │ ├── constructor.md │ │ │ ├── external.md │ │ │ ├── file_data.md │ │ │ ├── file_name.md │ │ │ ├── file_regex.md │ │ │ ├── filter.md │ │ │ ├── folder_name.md │ │ │ ├── folder_regex.md │ │ │ ├── for_each.md │ │ │ ├── generate_async.md │ │ │ ├── generate_internal_stream.md │ │ │ ├── generate_node_stream.md │ │ │ ├── load_async.md │ │ │ ├── load_async_object.md │ │ │ ├── remove.md │ │ │ ├── support.md │ │ │ └── version.md │ │ ├── api_streamhelper.md │ │ ├── api_streamhelper │ │ │ ├── accumulate.md │ │ │ ├── on.md │ │ │ ├── pause.md │ │ │ └── resume.md │ │ ├── api_zipobject.md │ │ ├── api_zipobject │ │ │ ├── async.md │ │ │ ├── internal_stream.md │ │ │ └── node_stream.md │ │ ├── contributing.md │ │ ├── css │ │ │ ├── main.css │ │ │ └── pygments.css │ │ ├── examples.md │ │ ├── examples │ │ │ ├── download-zip-file.html │ │ │ ├── download-zip-file.inc │ │ │ │ ├── blob.html │ │ │ │ ├── blob.js │ │ │ │ ├── data_uri.html │ │ │ │ └── data_uri.js │ │ │ ├── downloader.html │ │ │ ├── downloader.inc │ │ │ │ ├── downloader.html │ │ │ │ ├── downloader.js │ │ │ │ └── helpers.js │ │ │ ├── get-binary-files-ajax.html │ │ │ ├── get-binary-files-ajax.inc │ │ │ │ ├── fetch_api.html │ │ │ │ ├── fetch_api.js │ │ │ │ ├── jszip_utils.html │ │ │ │ └── jszip_utils.js │ │ │ ├── read-local-file-api.html │ │ │ └── read-local-file-api.inc │ │ │ │ ├── read.html │ │ │ │ └── read.js │ │ ├── faq.md │ │ ├── howto │ │ │ ├── read_zip.md │ │ │ └── write_zip.md │ │ ├── limitations.md │ │ └── upgrade_guide.md │ ├── index.html │ ├── lib │ │ ├── base64.js │ │ ├── compressedObject.js │ │ ├── compressions.js │ │ ├── crc32.js │ │ ├── defaults.js │ │ ├── external.js │ │ ├── flate.js │ │ ├── generate │ │ │ ├── ZipFileWorker.js │ │ │ └── index.js │ │ ├── index.js │ │ ├── license_header.js │ │ ├── load.js │ │ ├── nodejs │ │ │ ├── NodejsStreamInputAdapter.js │ │ │ └── NodejsStreamOutputAdapter.js │ │ ├── nodejsUtils.js │ │ ├── object.js │ │ ├── readable-stream-browser.js │ │ ├── reader │ │ │ ├── ArrayReader.js │ │ │ ├── DataReader.js │ │ │ ├── NodeBufferReader.js │ │ │ ├── StringReader.js │ │ │ ├── Uint8ArrayReader.js │ │ │ └── readerFor.js │ │ ├── signature.js │ │ ├── stream │ │ │ ├── ConvertWorker.js │ │ │ ├── Crc32Probe.js │ │ │ ├── DataLengthProbe.js │ │ │ ├── DataWorker.js │ │ │ ├── GenericWorker.js │ │ │ └── StreamHelper.js │ │ ├── support.js │ │ ├── utf8.js │ │ ├── utils.js │ │ ├── zipEntries.js │ │ ├── zipEntry.js │ │ └── zipObject.js │ ├── package-lock.json │ ├── package.json │ ├── test │ │ ├── asserts │ │ │ ├── constructor.js │ │ │ ├── delete.js │ │ │ ├── deprecated.js │ │ │ ├── external.js │ │ │ ├── file.js │ │ │ ├── filter.js │ │ │ ├── foreach.js │ │ │ ├── generate.js │ │ │ ├── load.js │ │ │ ├── permissions.js │ │ │ ├── stream.js │ │ │ ├── unicode.js │ │ │ └── version.js │ │ ├── helpers │ │ │ ├── browser-test-utils.js │ │ │ ├── node-test-utils.js │ │ │ └── test-utils.js │ │ ├── index.html │ │ ├── jquery-1.8.3.min.js │ │ ├── ref │ │ │ ├── all-stream.zip │ │ │ ├── all.7zip.zip │ │ │ ├── all.windows.zip │ │ │ ├── all.zip │ │ │ ├── all_appended_bytes.zip │ │ │ ├── all_missing_bytes.zip │ │ │ ├── all_prepended_bytes.zip │ │ │ ├── archive_comment.zip │ │ │ ├── backslash.zip │ │ │ ├── complex_files │ │ │ │ ├── AntarcticaTemps.ods │ │ │ │ ├── AntarcticaTemps.xlsx │ │ │ │ ├── Franz Kafka - The Metamorphosis.epub │ │ │ │ └── Outlook2007_Calendar.xps │ │ │ ├── data_descriptor.zip │ │ │ ├── deflate-stream.zip │ │ │ ├── deflate.zip │ │ │ ├── empty.zip │ │ │ ├── encrypted.zip │ │ │ ├── extra_attributes.zip │ │ │ ├── folder.zip │ │ │ ├── image.zip │ │ │ ├── invalid │ │ │ │ ├── bad_decompressed_size.zip │ │ │ │ ├── bad_offset.zip │ │ │ │ ├── compression.zip │ │ │ │ └── crc32.zip │ │ │ ├── local_encoding_in_name.zip │ │ │ ├── nested.zip │ │ │ ├── nested_data_descriptor.zip │ │ │ ├── nested_zip64.zip │ │ │ ├── permissions │ │ │ │ ├── linux_7z.zip │ │ │ │ ├── linux_ark.zip │ │ │ │ ├── linux_file_roller-ubuntu.zip │ │ │ │ ├── linux_file_roller-xubuntu.zip │ │ │ │ ├── linux_zip.zip │ │ │ │ ├── mac_finder.zip │ │ │ │ ├── windows_7z.zip │ │ │ │ ├── windows_compressed_folders.zip │ │ │ │ ├── windows_izarc.zip │ │ │ │ └── windows_winrar.zip │ │ │ ├── pile_of_poo.zip │ │ │ ├── slashes_and_izarc.zip │ │ │ ├── store-stream.zip │ │ │ ├── store.zip │ │ │ ├── subfolder.zip │ │ │ ├── text.zip │ │ │ ├── utf8.zip │ │ │ ├── utf8_in_name.zip │ │ │ ├── winrar_utf8_in_name.zip │ │ │ ├── zip64.zip │ │ │ ├── zip64_appended_bytes.zip │ │ │ ├── zip64_missing_bytes.zip │ │ │ └── zip64_prepended_bytes.zip │ │ └── smile.gif │ └── vendor │ │ └── FileSaver.js └── jquery-3.3.1.min.js ├── main.js ├── manifest.json ├── popup.html ├── sb2_to_cpp.js ├── sb3_to_cpp.js ├── scrshot.png ├── scrshot2.png ├── scrshot3.png └── scrshot4.png /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Yuki Yoshida 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | The description in English is provided [below Japanese one](#eng). 2 | 3 | # scratch2cpp 4 | 5 | **〜 Scratch でプログラミングコンテストに参加したい方へ 〜** 6 | 7 | ここには,以下の 2 つのものがあります: 8 | 9 | 1. AtCoder に Scratch 3.0 で参加できるようになる Chrome 拡張 `Scratcher's AtCoder` のソースコード. 10 | Scratch 3.0 プロジェクトファイル (.sb3) を C++ ソース (.cpp) に変換する 11 | JavaScript コードが含まれています. 12 | 13 | 2. Scratch 2.0 のコードを C++ コード (.cpp) に変換できる,コード変換ツール.(Python3 製です.) 14 | 15 | **1 については, [こちら](/web/crx/README.md)をご覧ください.** 16 | 17 | 2 については,[こちら](/sb2-tool/README.md)をご覧ください. 18 | 19 | --- 20 | 21 | 22 | 23 | # scratch2cpp 24 | 25 | **for Scratchers who want to participate in programming contests** 26 | 27 | There are two things here: 28 | 29 | 1. Codes of the Chrome extension `Scratcher's AtCoder`, with which you can participate in AtCoder with Scratch 3.0. 30 | It contains JavaScript code which converts Scratch 3.0 project file (.sb3) into C++ source code (.cpp). 31 | 32 | 2. Code converting tool which works offline. You can convert Scratch 2.0 project file (.sb2) into C++ source code (.cpp). (developed in Python3) 33 | 34 | **For 1, please see [this page](/web/crx/README.md).** 35 | 36 | For 2, please see [this page](/sb2-tool/README.md). 37 | -------------------------------------------------------------------------------- /blocks.md: -------------------------------------------------------------------------------- 1 | English version is [here](#english). 2 | 3 | 4 | # scratch2cpp で つかえる ブロック 5 | 6 | ### イベント 7 | 8 | * `(はた)がクリックされたとき` : ここから しょりが はじまります 9 | 10 | ### みため 11 | 12 | * `... という` : ひょうじゅんしゅつりょく に 1ぎょう しゅつりょくします 13 | 14 | * `... と ... びょういう` : うえと おなじです(びょうすうは むしされます) 15 | 16 | * `... とかんがえる` : ひょうじゅんエラーしゅつりょく に 1ぎょう しゅつりょくします 17 | 18 | * `... と ... びょうかんがえる` : うえと おなじです(びょうすうは むしされます) 19 | 20 | ### せいぎょ 21 | 22 | * `... かいくりかえす` 23 | 24 | * `ずっと` 25 | 26 | * `もし ... なら` 27 | 28 | * `もし ... なら / でなければ` 29 | 30 | * `... までくりかえす` 31 | 32 | * `... をとめる` : しょりを しゅうりょうします(オプションは どれでも いっしょです) 33 | 34 | ### しらべる 35 | 36 | * `... ときいてまつ` : ひょうじゅんにゅうりょく から あたい(スペース または かいぎょうで くぎられた かたまり)を 1つ にゅうりょくします 37 | 38 | * `こたえ` : `... ときいてまつ` ブロックの こたえが はいります 39 | 40 | ### えんざん 41 | 42 | (すべて つかえます) 43 | 44 | * Scratch では おおもじ と こもじ は くべつされませんが C++ では くべつされます!("APPLE" と "apple" は ことなります) 45 | 46 | * じょうけんを あらわす ろっかっけいの ブロックは かならず ろっかっけいの あなに いれるように してください!(まるい あなには いれないで) 47 | 48 | ### データ 49 | 50 | (すべて つかえます) 51 | 52 | ### そのた 53 | 54 | * `ブロックをつくる` : しょりのまとまりを ていぎできます 55 | 56 | 57 | 58 | # Blocks supported in scratch2cpp 59 | 60 | ### Events 61 | 62 | * `when :Flag: clicked` : specify entry point 63 | 64 | ### Looks 65 | 66 | * `say ...` : output a line to standard output 67 | 68 | * `say ... for ... secs` : same as above (secs is ignored) 69 | 70 | * `think ...` : output a line to standard error 71 | 72 | * `think ... for ... secs` : same as above (secs is ignored) 73 | 74 | ### Control 75 | 76 | * `repeat ...` 77 | 78 | * `forever` 79 | 80 | * `if ... then` 81 | 82 | * `if ... then / else` 83 | 84 | * `repeat until ...` 85 | 86 | * `stop ...` : terminate script (the option is ignored) 87 | 88 | ### Sensing 89 | 90 | * `ask ... and wait` : input a value from standard input (values are split by spaces and returns) 91 | 92 | * `answer` : storage for `ask ... and wait` block 93 | 94 | ### Operators 95 | 96 | (every operator is supported.) 97 | 98 | * Note that Scratch is case-insensitive, but C++ is case-sensitive (that is, "APPLE" is not equal to "apple".) 99 | 100 | * Make sure that hexagonal blocks (condition blocks) are put in hexagonal holes only (not circular ones). 101 | 102 | ### Data 103 | 104 | (every manipulation of data is supported.) 105 | 106 | ### More Blocks 107 | 108 | * `Make a Block` : define procedures 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /sb2-tool/README.md: -------------------------------------------------------------------------------- 1 | The description in English is provided [below Japanese one](#eng). 2 | 3 | # sb2-tool 4 | 5 | Scratch 2.0 のコードを C++ ソース (.cpp) に変換できるコード変換ツール 6 | 7 | ## インストール 8 | 9 | ``` 10 | git clone https://github.com/yos1up/scratch2cpp.git 11 | ``` 12 | 13 | ## 依存ライブラリ 14 | 15 | - Python3 16 | 17 | ## Scratch 2.0 でプログラミングコンテストに参加する方法 18 | 19 | 1. Create a Scratch 2.0 project which solves the problem. 20 | 21 | - Use `when [Flag] clicked` block to specify the entry point. 22 | 23 | - Use `ask ... and wait` block to get a value from standard input. (The value will be stored in `answer`.) (The asking message is arbitrary. ) 24 | 25 | - Use `say ...` block to output a line to standard output. (Use `think ...` block to output a line to stderr.) 26 | 27 | - Use `stop ...` block to terminate your program in the middle of the script. (The option is arbitrary. ) 28 | 29 | 2. Save your project as a .sb2 file. 30 | 31 | 3. `python sb2_to_cpp.py scratch_project_file.sb2 -o output_file.cpp` 32 | 33 | 4. submit the content of `output_file.cpp`. 34 | 35 | ## Scratch での解答例 36 | 37 | こちらをどうぞ. https://scratch.mit.edu/studios/5346476/ 38 | 39 | ## scratch2cpp が対応しているブロック 40 | 41 | [こちら](/blocks.md)をどうぞ. 42 | 43 | --- 44 | 45 | 46 | 47 | # sb2-tool 48 | 49 | Code converting tool which works offline. You can convert Scratch 2.0 project file (.sb2) into C++ source code (.cpp) 50 | 51 | ## Installation 52 | 53 | ``` 54 | git clone https://github.com/yos1up/scratch2cpp.git 55 | ``` 56 | 57 | ## Dependency 58 | 59 | - Python3 60 | 61 | ## How to participate in programming contests in Scratch 2.0 62 | 63 | 1. Create a Scratch 2.0 project which solves the problem. 64 | 65 | - Use `when [Flag] clicked` block to specify the entry point. 66 | 67 | - Use `ask ... and wait` block to get a value from standard input. (The value will be stored in `answer`.) (The asking message is arbitrary. ) 68 | 69 | - Use `say ...` block to output a line to standard output. (Use `think ...` block to output a line to stderr.) 70 | 71 | - Use `stop ...` block to terminate your program in the middle of the script. (The option is arbitrary. ) 72 | 73 | 2. Save your project as a .sb2 file. 74 | 75 | 3. `python sb2_to_cpp.py scratch_project_file.sb2 -o output_file.cpp` 76 | 77 | 4. submit the content of `output_file.cpp`. 78 | 79 | ## Example of Scratch projects 80 | 81 | See https://scratch.mit.edu/studios/5346476/ 82 | 83 | ## Blocks supported in scratch2cpp 84 | 85 | See [here](/blocks.md). 86 | -------------------------------------------------------------------------------- /web/crx/README.md: -------------------------------------------------------------------------------- 1 | # Chrome extension "Scratcher's AtCoder" 2 | 3 | 4 | ## Installation 5 | 6 | This Chrome extension is released at the [web store](https://chrome.google.com/webstore/detail/scratchers-atcoder/hackndbjgkehhjinjjoldifbhnfddklh). You can install it from there. 7 | 8 | Alternatively, you can install it manually: 9 | 10 | 1. Clone or download this directory 11 | 12 | 2. Launch Google Chrome and go to Window -> Extensions 13 | 14 | 3. Turn on "Developper Mode" 15 | 16 | 4. "Load Unpacked Extension" -> select this directory ( `crx` ) 17 | 18 | After installation (and activation), go to AtCoder (https://atcoder.jp/). 19 | There will be orange buttons in submit pages and problem pages. 20 | 21 |

screen shot

22 | 23 | ## Usage 24 | 25 | 1. Go to a submission form of AtCoder, and click orange "Scratch 3.0 online editor" button to open the online editor. 26 | 27 | 2. Create your solution in Scratch online editor. If your solution is ready, download your Scratch project to a local file. ([File] -> [Save to your computer]) 28 | 29 | 3. Return to AtCoder and click the orange "Load Scratch project" button. Then select your Scratch project file you downloaded in (2). 30 | 31 | 4. Your Scratch project file will be instantly converted to C++ source, and displayed in the solution form. 32 | 33 | 5. Submit it! (Make sure that "C++14(GCC 5.4.1)" (or newer) is selected as the language.) 34 | 35 | ## Blocks supported in scratch2cpp 36 | 37 | See [here](../../blocks.md). 38 | -------------------------------------------------------------------------------- /web/crx/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/icon.png -------------------------------------------------------------------------------- /web/crx/icon.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/icon.xcf -------------------------------------------------------------------------------- /web/crx/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/icon128.png -------------------------------------------------------------------------------- /web/crx/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/icon16.png -------------------------------------------------------------------------------- /web/crx/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/icon48.png -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/.codeclimate.yml: -------------------------------------------------------------------------------- 1 | --- 2 | engines: 3 | duplication: 4 | enabled: true 5 | config: 6 | languages: 7 | - javascript 8 | eslint: 9 | enabled: true 10 | fixme: 11 | enabled: true 12 | ratings: 13 | paths: 14 | - "lib/*.js" 15 | exclude_paths: 16 | - "dist/*" 17 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 4 9 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | node_modules 3 | sauce_connect.log 4 | .c9revisions -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/.jshintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "nonew": true, 5 | "noarg": true, 6 | "forin": true, 7 | "futurehostile": true, 8 | "freeze": true, 9 | "undef": true, 10 | "strict": true, 11 | "sub": true, 12 | "esversion": 3, 13 | 14 | "globals": { 15 | "TextEncoder": false, 16 | "TextDecoder": false, 17 | "self": true 18 | }, 19 | "browser": true, 20 | "node": true 21 | } 22 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/.npmignore: -------------------------------------------------------------------------------- 1 | _config.yml 2 | bower.json 3 | component.json 4 | docs 5 | documentation 6 | Gruntfile.js 7 | index.html 8 | test 9 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | matrix: 4 | include: 5 | - node_js: "stable" 6 | env: COMMAND=lint 7 | - node_js: "0.10" 8 | env: COMMAND=test-node 9 | - node_js: "0.12" 10 | env: COMMAND=test-node 11 | - node_js: "4.4" 12 | env: COMMAND=test-node 13 | - node_js: "stable" 14 | env: COMMAND=test-node 15 | - node_js: "stable" 16 | env: COMMAND=test-browser 17 | env: 18 | global: 19 | - secure: MhA8GHU42X3GWTUMaqdZVvarx4BMjhQCUGNi3kvuD/iCmKVb7gMwj4jbds7AcJdsCRsRk8bBGzZs/E7HidBJMPDa5DhgLKy9EV1s42JlHq8lVzbJeWIGgrtyJvhVUkGRy2OJjnDSgh3U6elkQmvDn74jreSQc6m/yGoPFF1nqq8= 20 | - secure: qREw6aUu2DnB+2reMuHgygSkumRiJvt7Z5Fz4uEVoraqbe65e4PGhtzypr9uIgCN43vxS2D5tAIeDbfid5VQrWFUQnrC9O5Z5qgVPsKN94zZ1tvYurXI4wRlAg58nNjkfGXWhLI3VUjjDTp5gYcMqgfe5hpEFYUPnUQkKGnaqAk= 21 | script: npm run $COMMAND 22 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/Gruntfile.js: -------------------------------------------------------------------------------- 1 | /*jshint node: true */ 2 | 'use strict'; 3 | module.exports = function(grunt) { 4 | // see https://saucelabs.com/rest/v1/info/browsers/webdriver 5 | var browsers = [{ 6 | browserName: "iphone", 7 | version: "7.0" 8 | }, { 9 | browserName: "iphone", 10 | version: "9.2" 11 | }, { 12 | browserName: "android", 13 | platform: "Linux", 14 | version: "4.0" 15 | }, { 16 | browserName: "android", 17 | platform: "Linux", 18 | version: "4.4" 19 | }, { 20 | browserName: "android", 21 | platform: "Linux", 22 | version: "5.1" 23 | }, { 24 | browserName: "firefox", 25 | platform: "Windows 10" 26 | }, { 27 | browserName: "chrome", 28 | platform: "Windows 10" 29 | }, { 30 | browserName: "internet explorer", 31 | platform: "XP", 32 | version: "6" 33 | }, { 34 | browserName: "internet explorer", 35 | platform: "XP", 36 | version: "7" 37 | }, { 38 | browserName: "internet explorer", 39 | platform: "Windows 7", 40 | version: "8" 41 | }, { 42 | browserName: "internet explorer", 43 | platform: "Windows 7", 44 | version: "9" 45 | }, { 46 | browserName: "internet explorer", 47 | platform: "Windows 8", 48 | version: "10" 49 | }, { 50 | browserName: "internet explorer", 51 | platform: "Windows 10", 52 | version: "11" 53 | }, { 54 | browserName: "MicrosoftEdge", 55 | platform: "Windows 10", 56 | version: "13" 57 | }, { 58 | browserName: "opera", 59 | platform: "Windows 2008", 60 | version: "12" 61 | }, { 62 | browserName: "safari", 63 | platform: "OS X 10.8", 64 | version: "6" 65 | }, { 66 | browserName: "safari", 67 | platform: "OS X 10.9", 68 | version: "7" 69 | }, { 70 | browserName: "safari", 71 | platform: "OS X 10.10", 72 | version: "8" 73 | }, { 74 | browserName: "safari", 75 | platform: "OS X 10.11", 76 | version: "9" 77 | }]; 78 | 79 | var tags = []; 80 | if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST != "false") { 81 | tags.push("pr" + process.env.TRAVIS_PULL_REQUEST); 82 | } else if (process.env.TRAVIS_BRANCH) { 83 | tags.push(process.env.TRAVIS_BRANCH); 84 | } 85 | 86 | var version = require("./package.json").version; 87 | 88 | grunt.initConfig({ 89 | connect: { 90 | server: { 91 | options: { 92 | base: "", 93 | port: 9999 94 | } 95 | } 96 | }, 97 | 'saucelabs-qunit': { 98 | all: { 99 | options: { 100 | urls: ["http://127.0.0.1:9999/test/index.html?hidepassed"], 101 | build: process.env.TRAVIS_JOB_ID, 102 | throttled: 3, 103 | "max-duration" : 600, // seconds, IE6 is slow 104 | browsers: browsers, 105 | testname: "qunit tests", 106 | tags: tags 107 | } 108 | } 109 | }, 110 | jshint: { 111 | // see https://github.com/gruntjs/grunt-contrib-jshint/issues/198 112 | // we can't override the options using the jshintrc path 113 | options: grunt.file.readJSON('.jshintrc'), 114 | production: ['./lib/**/*.js'], 115 | test: ['./test/helpers/**/*.js', './test/asserts/**/*.js'], 116 | documentation: { 117 | options: { 118 | // we include js files with jekyll, jshint can't see all 119 | // variables and we can't declare all of them 120 | undef: false, 121 | // 'implied' still give false positives in our case 122 | strict: false 123 | }, 124 | files: { 125 | src: ['./documentation/**/*.js'] 126 | } 127 | } 128 | }, 129 | browserify: { 130 | all: { 131 | files: { 132 | 'dist/jszip.js': ['lib/index.js'] 133 | }, 134 | options: { 135 | browserifyOptions: { 136 | standalone: 'JSZip', 137 | transform: ['package-json-versionify'], 138 | insertGlobalVars: { 139 | process: undefined, 140 | Buffer: undefined, 141 | __filename: undefined, 142 | __dirname: undefined 143 | }, 144 | builtins: false 145 | }, 146 | banner : grunt.file.read('lib/license_header.js').replace(/__VERSION__/, version) 147 | } 148 | } 149 | }, 150 | uglify: { 151 | options: { 152 | mangle: true, 153 | preserveComments: false, 154 | banner : grunt.file.read('lib/license_header.js').replace(/__VERSION__/, version) 155 | }, 156 | all: { 157 | src: 'dist/jszip.js', 158 | dest: 'dist/jszip.min.js' 159 | } 160 | }, 161 | qunit: { 162 | all: ['test/**/*.html'] 163 | } 164 | }); 165 | 166 | grunt.loadNpmTasks("grunt-saucelabs"); 167 | grunt.loadNpmTasks("grunt-contrib-connect"); 168 | grunt.loadNpmTasks('grunt-browserify'); 169 | grunt.loadNpmTasks('grunt-contrib-jshint'); 170 | grunt.loadNpmTasks('grunt-contrib-uglify'); 171 | grunt.loadNpmTasks('grunt-contrib-qunit'); 172 | 173 | if (process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY) { 174 | grunt.registerTask("test", ["qunit", "connect", "saucelabs-qunit"]); 175 | } else { 176 | grunt.registerTask("test", ["qunit"]); 177 | } 178 | grunt.registerTask("build", ["browserify", "uglify"]); 179 | grunt.registerTask("default", ["jshint", "build"]); 180 | }; 181 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/README.markdown: -------------------------------------------------------------------------------- 1 | JSZip [![Build Status](https://api.travis-ci.org/Stuk/jszip.svg?branch=master)](http://travis-ci.org/Stuk/jszip) [![Code Climate](https://codeclimate.com/github/Stuk/jszip/badges/gpa.svg)](https://codeclimate.com/github/Stuk/jszip) 2 | ===== 3 | 4 | [![Selenium Test Status](https://saucelabs.com/browser-matrix/jszip.svg)](https://saucelabs.com/u/jszip) 5 | 6 | A library for creating, reading and editing .zip files with JavaScript, with a 7 | lovely and simple API. 8 | 9 | See https://stuk.github.io/jszip for all the documentation. 10 | 11 | ```javascript 12 | var zip = new JSZip(); 13 | 14 | zip.file("Hello.txt", "Hello World\n"); 15 | 16 | var img = zip.folder("images"); 17 | img.file("smile.gif", imgData, {base64: true}); 18 | 19 | zip.generateAsync({type:"blob"}).then(function(content) { 20 | // see FileSaver.js 21 | saveAs(content, "example.zip"); 22 | }); 23 | 24 | /* 25 | Results in a zip containing 26 | Hello.txt 27 | images/ 28 | smile.gif 29 | */ 30 | ``` 31 | License 32 | ------- 33 | 34 | JSZip is dual-licensed. You may use it under the MIT license *or* the GPLv3 35 | license. See [LICENSE.markdown](LICENSE.markdown). 36 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/_config.yml: -------------------------------------------------------------------------------- 1 | # will be overwritten by github, see https://help.github.com/articles/using-jekyll-with-pages 2 | lsi: false 3 | safe: true 4 | source: ./ 5 | incremental: false 6 | highlighter: rouge 7 | gist: 8 | noscript: false 9 | # /overwritten 10 | 11 | baseurl: /jszip 12 | 13 | layouts_dir: ./documentation/_layouts 14 | permalink: none 15 | exclude: ['bin', 'README.md', 'node_modules'] 16 | 17 | 18 | kramdown: 19 | input: GFM 20 | hard_wrap: false 21 | gems: 22 | - jekyll-coffeescript 23 | - jekyll-paginate 24 | 25 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jszip", 3 | "homepage": "http://stuartk.com/jszip", 4 | "authors": [ 5 | "Stuart Knightley " 6 | ], 7 | "description": "Create, read and edit .zip files with JavaScript http://stuartk.com/jszip", 8 | "main": "dist/jszip.js", 9 | "keywords": [ 10 | "zip", 11 | "deflate", 12 | "inflate" 13 | ], 14 | "license": "MIT or GPLv3", 15 | "ignore": [ 16 | "**/.*", 17 | "node_modules", 18 | "bower_components", 19 | "test", 20 | "tests" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jszip", 3 | "repo": "Stuk/jszip", 4 | "description": "Create, read and edit .zip files with JavaScript http://stuartk.com/jszip", 5 | "version": "3.1.5", 6 | "keywords": [ 7 | "zip", 8 | "deflate", 9 | "inflate" 10 | ], 11 | "main": "dist/jszip.js", 12 | "license": "MIT or GPLv3", 13 | "scripts": [ 14 | "dist/jszip.js" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/docs/ZIP spec.txt: -------------------------------------------------------------------------------- 1 | Here are the notes I made while working through the ZIP file specification. 2 | 3 | For each file: 4 | 5 | local file header signature 4 bytes (0x04034b50) 6 | version needed to extract 2 bytes 7 | general purpose bit flag 2 bytes 8 | compression method 2 bytes 9 | last mod file time 2 bytes 10 | last mod file date 2 bytes 11 | crc-32 4 bytes 12 | compressed size 4 bytes 13 | uncompressed size 4 bytes 14 | file name length 2 bytes 15 | extra field length 2 bytes 16 | 17 | |sig |v |g |c |t |d |crc |csz |usz |n |x | 18 | PK.. ## 00 00 ?? ?? xxxx ???? ???? ?? 00 19 | 20 | 21 | Central directory: 22 | 23 | central file header signature 4 bytes (0x02014b50) 24 | version made by 2 bytes 25 | version needed to extract 2 bytes * 26 | general purpose bit flag 2 bytes * 27 | compression method 2 bytes * 28 | last mod file time 2 bytes * 29 | last mod file date 2 bytes * 30 | crc-32 4 bytes * 31 | compressed size 4 bytes * 32 | uncompressed size 4 bytes * 33 | file name length 2 bytes * 34 | extra field length 2 bytes * 35 | file comment length 2 bytes 36 | disk number start 2 bytes 37 | internal file attributes 2 bytes 38 | external file attributes 4 bytes 39 | relative offset of local header 4 bytes 40 | 41 | file name (variable size) 42 | extra field (variable size) 43 | file comment (variable size) 44 | 45 | |sig |vm|vx|g |c |d |t |crc |csz |usz |n |x |cm|dn|ia|xa |roff| 46 | PK.. ## ## 00 00 ?? ?? xxxx ???? ???? ?? 00 00 00 00 xxxx ???? 47 | 48 | End of central directory: 49 | 50 | end of central dir signature 4 bytes (0x06054b50) 51 | number of this disk 2 bytes 52 | number of the disk with the 53 | start of the central directory 2 bytes 54 | total number of entries in the 55 | central directory on this disk 2 bytes 56 | total number of entries in 57 | the central directory 2 bytes 58 | size of the central directory 4 bytes 59 | offset of start of central 60 | directory with respect to 61 | the starting disk number 4 bytes 62 | .ZIP file comment length 2 bytes 63 | .ZIP file comment (variable size) 64 | 65 | |sig |n1|n2|e |ne|size|off |cm| 66 | PK.. 00 00 ?? ?? ???? ???? 00 67 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/docs/references.txt: -------------------------------------------------------------------------------- 1 | Zip format 2 | ---------- 3 | http://www.pkware.com/support/zip-application-note 4 | http://www.xxcopy.com/xxcopy06.htm 5 | 6 | Data URL 7 | -------- 8 | https://developer.mozilla.org/en/The_data_URL_scheme 9 | http://msdn.microsoft.com/en-us/library/cc848897(VS.85).aspx 10 | http://www.phpied.com/mhtml-when-you-need-data-uris-in-ie7-and-under/ 11 | 12 | http://www.motobit.com/util/base64-decoder-encoder.asp 13 | 14 | Saving files 15 | ------------ 16 | http://msdn.microsoft.com/en-us/library/ms536676(VS.85).aspx 17 | http://msdn.microsoft.com/en-us/library/ms536419(VS.85).aspx 18 | http://msdn.microsoft.com/en-us/library/ms537418(VS.85).aspx 19 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "JSZip API" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | An instance of JSZip represents a set of files. You can add them, remove them, 8 | modify them. You can also import an existing zip file or generate one. 9 | 10 | ### Attributes 11 | 12 | attribute name | type | description 13 | ---------------------|-------------|------------- 14 | `files` | object | the [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html)s inside the zip with the name as key. See [file(name)]({{site.baseurl}}/documentation/api_jszip/file_name.html). 15 | `comment` | string | the comment of the zip file. 16 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/constructor.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "new JSZip() or JSZip()" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Create a new JSZip instance. 8 | 9 | __Returns__ : A new JSZip. 10 | 11 | __Since__: v1.0.0 12 | 13 | ## Example 14 | 15 | ```js 16 | var zip = new JSZip(); 17 | // same as 18 | var zip = JSZip(); 19 | ``` 20 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/external.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "JSZip.external" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | JSZip uses objects that may not exist on every platform, in which case it uses 8 | a shim. 9 | Accessing or replacing these objects can sometimes be useful. JSZip.external 10 | contains the following properties : 11 | 12 | * `Promise` : the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) implementation used. 13 | 14 | The global object is prefered when available. 15 | 16 | __Example__ 17 | 18 | ```js 19 | // use bluebird instead 20 | JSZip.external.Promise = Bluebird; 21 | 22 | // use the native Promise object: 23 | JSZip.external.Promise = Promise; 24 | ``` 25 | 26 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/file_name.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "file(name)" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Get a file with the specified name. You can specify folders 8 | in the name : the folder separator is a forward slash ("/"). 9 | 10 | __Returns__ : An instance of [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html) representing 11 | the file if any, `null` otherwise. 12 | 13 | __Since__: v1.0.0 14 | 15 | ## Arguments 16 | 17 | name | type | description 18 | -----|--------|------------- 19 | name | string | the name of the file. 20 | 21 | __Throws__ : Nothing. 22 | 23 | 24 | 25 | ## Example 26 | 27 | ```js 28 | var zip = new JSZip(); 29 | zip.file("file.txt", "content"); 30 | 31 | zip.file("file.txt").name // "file.txt" 32 | zip.file("file.txt").async("string") // a promise of "content" 33 | zip.file("file.txt").dir // false 34 | 35 | // utf8 example 36 | var zip = new JSZip(); 37 | zip.file("amount.txt", "€15"); 38 | zip.file("amount.txt").async("string") // a promise of "€15" 39 | zip.file("amount.txt").async("arraybuffer") // a promise of an ArrayBuffer containing €15 encoded as utf8 40 | zip.file("amount.txt").async("uint8array") // a promise of an Uint8Array containing €15 encoded as utf8 41 | 42 | // with folders 43 | zip.folder("sub").file("file.txt", "content"); 44 | zip.file("sub/file.txt"); // the file 45 | // or 46 | zip.folder("sub").file("file.txt") // the file 47 | ``` 48 | 49 | 50 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/file_regex.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "file(regex)" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Search a file in the current folder and subfolders with a 8 | [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions). 9 | The regex is tested against the relative filename. 10 | 11 | __Returns__ : An array of matching files (an empty array if none matched). Each 12 | matching file is an instance of [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html). 13 | 14 | __Since__: v1.0.0 15 | 16 | ## Arguments 17 | 18 | name | type | description 19 | ------|--------|------------ 20 | regex | RegExp | the regex to use. 21 | 22 | ## Example 23 | 24 | ```js 25 | var zip = new JSZip(); 26 | zip.file("file1.txt", "content"); 27 | zip.file("file2.txt", "content"); 28 | 29 | zip.file(/file/); // array of size 2 30 | 31 | // example with a relative path : 32 | var folder = zip.folder("sub"); 33 | folder 34 | .file("file3.txt", "content") // relative path from folder : file3.txt 35 | .file("file4.txt", "content"); // relative path from folder : file4.txt 36 | 37 | folder.file(/file/); // array of size 2 38 | folder.file(/^file/); // array of size 2, the relative paths start with file 39 | 40 | // arrays contain objects in the form: 41 | // {name: "file2.txt", dir: false, async : function () {...}, ...} 42 | ``` 43 | 44 | 45 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "filter(predicate)" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Filter nested files/folders with the specified function. 8 | 9 | __Returns__ : An array of matching ZipObject. 10 | 11 | __Since__: v1.0.0 12 | 13 | ## Arguments 14 | 15 | name | type | description 16 | ----------|----------|------------ 17 | predicate | function | the predicate to use. 18 | 19 | The predicate has the following signature : `function (relativePath, file) {...}` : 20 | 21 | name | type | description 22 | -------------|-----------|------------ 23 | relativePath | string | the filename and its path, relative to the current folder. 24 | file | ZipObject | the file being tested. See [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html). 25 | 26 | The predicate must return true if the file should be included, false otherwise. 27 | 28 | 29 | ## Examples 30 | 31 | ```js 32 | var zip = new JSZip().folder("dir"); 33 | zip.file("readme.txt", "content"); 34 | zip.filter(function (relativePath, file){ 35 | // relativePath == "readme.txt" 36 | // file = {name:"dir/readme.txt",options:{...},async:function} 37 | return true/false; 38 | }); 39 | ``` 40 | 41 | 42 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/folder_name.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "folder(name)" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Create a directory if it doesn't exist, return a new JSZip 8 | object with the new folder as root. 9 | 10 | See also [the `dir` option of file()]({{site.baseurl}}/documentation/api_jszip/file_data.html). 11 | 12 | __Returns__ : A new JSZip (for chaining), with the new folder as root. 13 | 14 | __Since__: v1.0.0 15 | 16 | ## Arguments 17 | 18 | name | type | description 19 | -----|--------|------------ 20 | name | string | the name of the directory. 21 | 22 | ## Examples 23 | 24 | ```js 25 | zip.folder("images"); 26 | zip.folder("css").file("style.css", "body {background: #FF0000}"); 27 | // or specify an absolute path (using forward slashes) 28 | zip.file("css/font.css", "body {font-family: sans-serif}") 29 | 30 | // result : images/, css/, css/style.css, css/font.css 31 | ``` 32 | 33 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/folder_regex.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "folder(regex)" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Search a subdirectory in the current directory with a 8 | [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions). 9 | The regex is tested against the relative path. 10 | 11 | __Returns__ : An array of matching folders (an empty array if none matched). 12 | Each matching folder is an instance of [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html). 13 | 14 | __Since__: v1.0.0 15 | 16 | ## Arguments 17 | 18 | name | type | description 19 | ------|--------|------------ 20 | regex | RegExp | the regex to use. 21 | 22 | ## Examples 23 | 24 | ```js 25 | var zip = new JSZip(); 26 | zip.folder("home/Pierre/videos"); 27 | zip.folder("home/Pierre/photos"); 28 | zip.folder("home/Jean/videos"); 29 | zip.folder("home/Jean/photos"); 30 | 31 | zip.folder(/videos/); // array of size 2 32 | 33 | zip.folder("home/Jean").folder(/^vid/); // array of 1 34 | ``` 35 | 36 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/for_each.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "forEach(callback)" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Call a callback function for each entry at this folder level. 8 | 9 | __Returns__ : Nothing. 10 | 11 | __Since__: v3.0.0 12 | 13 | ## Arguments 14 | 15 | name | type | description 16 | ----------|----------|------------ 17 | callback | function | the callback to use. 18 | 19 | The callback has the following signature : `function (relativePath, file) {...}` : 20 | 21 | name | type | description 22 | -------------|-----------|------------ 23 | relativePath | string | the filename and its path, relative to the current folder. 24 | file | ZipObject | the current file. See [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html). 25 | 26 | 27 | ## Examples 28 | 29 | ```js 30 | var zip = new JSZip(); 31 | zip.file("package.json", "..."); 32 | zip.file("lib/index.js", "..."); 33 | zip.file("test/index.html", "..."); 34 | zip.file("test/asserts/file.js", "..."); 35 | zip.file("test/asserts/generate.js", "..."); 36 | 37 | zip.folder("test").forEach(function (relativePath, file){ 38 | console.log("iterating over", relativePath); 39 | }); 40 | 41 | // will display: 42 | // iterating over index.html 43 | // iterating over asserts/ 44 | // iterating over asserts/file.js 45 | // iterating over asserts/generate.js 46 | ``` 47 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/generate_internal_stream.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "generateInternalStream(options)" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Generates the complete zip file with the internal stream implementation. 8 | 9 | __Returns__ : a [StreamHelper]({{site.baseurl}}/documentation/api_streamhelper.html). 10 | 11 | __Since__: v3.0.0 12 | 13 | ## Arguments 14 | 15 | name | type | default | description 16 | --------------------|----------|---------|------------ 17 | options | object | | the options to generate the zip file, see [the options of `generateAsync()`]({{site.baseurl}}/documentation/api_jszip/generate_async.html) 18 | 19 | __Metadata__ : see [the metadata of `generateAsync()`]({{site.baseurl}}/documentation/api_jszip/generate_async.html#onupdate-callback). 20 | 21 | ## Examples 22 | 23 | ```js 24 | zip.generateInternalStream({type:"blob"}).accumulate(function callback(err, content) { 25 | if (err) { 26 | // handle error 27 | } 28 | // see FileSaver.js 29 | saveAs(content, "hello.zip"); 30 | }, function updateCallback(metadata) { 31 | // print progression with metadata.percent and metadata.currentFile 32 | }); 33 | ``` 34 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/generate_node_stream.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "generateNodeStream(options[, onUpdate])" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Generates the complete zip file as a nodejs stream. 8 | 9 | __Returns__ : a [nodejs Streams3](https://github.com/nodejs/readable-stream). 10 | 11 | __Since__: v3.0.0 12 | 13 | ## Arguments 14 | 15 | name | type | default | description 16 | --------------------|----------|---------|------------ 17 | options | object | | the options to generate the zip file, see [the options of `generateAsync()`]({{site.baseurl}}/documentation/api_jszip/generate_async.html) 18 | onUpdate | function | | The optional function called on each internal update with the metadata. 19 | 20 | The `type` parameter has here the default value of `nodebuffer`. 21 | Only `nodebuffer` is currently supported. 22 | 23 | __Metadata__ : see [the metadata of `generateAsync()`]({{site.baseurl}}/documentation/api_jszip/generate_async.html#onupdate-callback). 24 | 25 | ## Examples 26 | 27 | ```js 28 | zip 29 | .generateNodeStream({streamFiles:true}) 30 | .pipe(fs.createWriteStream('out.zip')) 31 | .on('finish', function () { 32 | // JSZip generates a readable stream with a "end" event, 33 | // but is piped here in a writable stream which emits a "finish" event. 34 | console.log("out.zip written."); 35 | }); 36 | ``` 37 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/load_async.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "loadAsync(data [, options])" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Read an existing zip and merge the data in the current JSZip 8 | object at the current folder level. This technique has some limitations, see 9 | [here]({{site.baseurl}}/documentation/limitations.html). 10 | If the JSZip object already contains entries, new entries will be merged. If 11 | two have the same name, the loaded one will replace the other. 12 | 13 | __Returns__ : A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) with the updated zip object. 14 | The promise can fail if the loaded data is not valid zip data or if it 15 | uses unsupported features (multi volume, password protected, etc). 16 | 17 | __Since__: v3.0.0 18 | 19 | ## Arguments 20 | 21 | name | type | description 22 | -------------------|--------|------------ 23 | data | String/Array of bytes/ArrayBuffer/Uint8Array/Buffer/Blob/Promise | the zip file 24 | options | object | the options to load the zip file 25 | 26 | Content of `options` : 27 | 28 | name | type | default | description 29 | ------------------------------|---------|---------|------------ 30 | options.base64 | boolean | false | set to `true` if the data is base64 encoded, `false` for binary. [More](#base64-option). 31 | options.checkCRC32 | boolean | false | set to `true` if the read data should be checked against its CRC32. [More](#checkcrc32-option). 32 | options.optimizedBinaryString | boolean | false | set to `true` if (and only if) the input is a string and has already been prepared with a 0xFF mask. 33 | options.createFolders | boolean | false | set to `true` to create folders in the file path automatically. Leaving it false will result in only virtual folders (i.e. folders that merely represent part of the file path) being created. [More](#createfolders-option). 34 | options.decodeFileName | function | decode from UTF-8 | the function to decode the file name / comment. [More](#decodefilename-option). 35 | 36 | You shouldn't update the data given to this method : it is kept as it so any 37 | update will impact the stored data. 38 | 39 | Zip features supported by this method : 40 | 41 | * Compression (DEFLATE supported) 42 | * zip with data descriptor 43 | * ZIP64 44 | * UTF8 in file name, UTF8 in file content 45 | 46 | Zip features not (yet) supported : 47 | 48 | * password protected zip 49 | * multi-volume zip 50 | 51 | ### `base64` option 52 | 53 | ```js 54 | var zip = new JSZip(); 55 | zip.loadAsync("UEsDBAoDAAAAAJxs8T...AAAAAA==", {base64: true}); 56 | ``` 57 | 58 | ### `checkCRC32` option 59 | 60 | The `checkCRC32` option will load every files, compute the CRC32 value and 61 | compare it against the saved value. 62 | With larger zip files, this option can have a significant performance cost. 63 | 64 | ```js 65 | // here, "bin" is a corrupted zip file 66 | 67 | zip.loadAsync(bin) 68 | .then(function (zip) { 69 | // will be called, even if content is corrupted 70 | }, function (e) { 71 | // won't be called 72 | }); 73 | 74 | zip.loadAsync(bin, { 75 | checkCRC32: true 76 | }) 77 | .then(function (zip) { 78 | // won't be called 79 | }, function (e) { 80 | // Error: Corrupted zip : CRC32 mismatch 81 | }); 82 | ``` 83 | 84 | ### `createFolders` option 85 | 86 | ```js 87 | // here, "bin" is zip file containing: 88 | // folder1/folder2/folder3/file1.txt 89 | 90 | zip.loadAsync(bin) 91 | .then(function (zip) { 92 | console.log(zip.files); 93 | // folder1/folder2/folder3/file1.txt 94 | }); 95 | 96 | // with createFolders: true, all folders will be created 97 | zip.loadAsync(bin, {createFolders: true}) 98 | .then(function (zip) { 99 | console.log(zip.files); 100 | // folder1/ 101 | // folder1/folder2/ 102 | // folder1/folder2/folder3/ 103 | // folder1/folder2/folder3/file1.txt 104 | }); 105 | ``` 106 | 107 | ### `decodeFileName` option 108 | 109 | A zip file has a flag to say if the filename and comment are encoded with UTF-8. 110 | If it's not set, JSZip has **no way** to know the encoding used. It usually 111 | is the default encoding of the operating system. Some extra fields can give 112 | the unicode version of the filename/comment too (in that case, we use it). 113 | 114 | If we can't find an UTF-8 encoded filename/comment, we use the `decodeFileName` 115 | function (which is by default an UTF-8 decode). 116 | 117 | The function takes the bytes array (Uint8Array or Array) and returns the 118 | decoded string. 119 | 120 | ```js 121 | // here, "bin" is a russian zip file, using the cp866 encoding for file names 122 | // by default, using UTF-8 leads to wrong file names: 123 | zip.loadAsync(bin) 124 | .then(function (zip) { 125 | console.log(zip.files); 126 | // '����� �����/': ... 127 | // '����� �����/����� ⥪�⮢�� ���㬥��.txt': ... 128 | }); 129 | 130 | // using the correct encoding solve the issue: 131 | var iconv = require('iconv-lite'); 132 | zip.loadAsync(bin, { 133 | decodeFileName: function (bytes) { 134 | return iconv.decode(bytes, 'cp866'); 135 | } 136 | }) 137 | .then(function (zip) { 138 | console.log(zip.files); 139 | // 'Новая папка/': ... 140 | // 'Новая папка/Новый текстовый документ.txt': ... 141 | }); 142 | ``` 143 | 144 | ## Other examples 145 | 146 | ```js 147 | var zip = new JSZip(); 148 | zip.loadAsync(zipDataFromXHR); 149 | ``` 150 | 151 | ```js 152 | require("fs").readFile("hello.zip", function (err, data) { 153 | if (err) throw err; 154 | var zip = new JSZip(); 155 | zip.loadAsync(data); 156 | } 157 | ``` 158 | 159 | Using sub folders : 160 | 161 | ```js 162 | // here, "bin" is zip file containing: 163 | // file1.txt 164 | // folder1/file2.txt 165 | 166 | var zip = new JSZip(); 167 | zip.folder("subfolder").loadAsync(bin) 168 | .then(function (zip) { 169 | // "zip" is still in the "subfolder" folder 170 | console.log(zip.files); 171 | // subfolder/file1.txt 172 | // subfolder/folder1/file2.txt 173 | }); 174 | ``` 175 | 176 | Using `loadAsync` multiple times: 177 | 178 | ```js 179 | // here, "bin1" is zip file containing: 180 | // file1.txt 181 | // file2.txt 182 | // and "bin2" is zip file containing: 183 | // file2.txt 184 | // file3.txt 185 | 186 | var zip = new JSZip(); 187 | zip.loadAsync(bin1) 188 | .then(function (zip) { 189 | return zip.loadAsync(bin2); 190 | }).then(function (zip) { 191 | console.log(zip.files); 192 | // file1.txt, from bin1 193 | // file2.txt, from bin2 194 | // file3.txt, from bin2 195 | }); 196 | ``` 197 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/load_async_object.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "JSZip.loadAsync(data [, options])" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | This is a shortcut for 8 | 9 | ```js 10 | var zip = new JSZip(); 11 | zip.loadAsync(data, options); 12 | ``` 13 | 14 | Please see the documentation of [loadAsync]({{site.baseurl}}/documentation/api_jszip/load_async.html). 15 | 16 | 17 | __Examples__ 18 | 19 | ```js 20 | dataAsPromise 21 | .then(JSZip.loadAsync) 22 | .then(function(zip) {...}) 23 | ``` 24 | 25 | same as: 26 | 27 | ```js 28 | JSZip.loadAsync(dataAsPromise) 29 | .then(function(zip) {...}) 30 | ``` 31 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/remove.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "remove(name)" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Delete a file or folder (recursively). 8 | 9 | __Returns__ : The current JSZip object. 10 | 11 | __Since__: v1.0.0 12 | 13 | ## Arguments 14 | 15 | name | type | description 16 | -----|--------|------------ 17 | name | string | the name of the file/folder to delete. 18 | 19 | ## Examples 20 | 21 | ```js 22 | var zip = new JSZip(); 23 | zip.file("Hello.txt", "Hello World\n"); 24 | zip.file("temp.txt", "nothing").remove("temp.txt"); 25 | // result : Hello.txt 26 | 27 | zip.folder("css").file("style.css", "body {background: #FF0000}"); 28 | zip.remove("css"); 29 | //result : empty zip 30 | ``` 31 | 32 | 33 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/support.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "JSZip.support" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | If the browser supports them, JSZip can take advantage of some "new" features : 8 | ArrayBuffer, Blob, Uint8Array. To know if JSZip can use them, you can check the 9 | JSZip.support object. It contains the following boolean properties : 10 | 11 | * `arraybuffer` : true if JSZip can read and generate ArrayBuffer, false otherwise. 12 | * `uint8array` : true if JSZip can read and generate Uint8Array, false otherwise. 13 | * `blob` : true if JSZip can generate Blob, false otherwise. 14 | * `nodebuffer` : true if JSZip can read and generate nodejs Buffer, false otherwise. 15 | * `nodestream` : true if JSZip can read and generate nodejs stream, false otherwise. 16 | 17 | 18 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_jszip/version.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "JSZip.version" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | The version of JSZip as a string. 8 | 9 | __Since__: v3.1.0 10 | 11 | ## Example 12 | 13 | ```js 14 | JSZip.version == "3.1.0"; 15 | ``` 16 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_streamhelper.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "StreamHelper API" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | A `StreamHelper` can be viewed as a pausable stream with some helper methods. 8 | It is not a full featured stream like in nodejs (and can't directly used as one) 9 | but the exposed methods should be enough to write the glue code with other async 10 | libraries : `on('data', function)`, `on('end', function)` and `on('error', function)`. 11 | 12 | It starts paused, be sure to `resume()` it when ready. 13 | 14 | If you are looking for an asynchronous helper without writing glue code, take a 15 | look at `accumulate(function)`. 16 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_streamhelper/accumulate.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "accumulate([updateCallback])" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Read the whole stream and call a callback with the complete content. 8 | 9 | __Returns__ : A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 10 | of the full content. 11 | 12 | __Since__: v3.0.0 13 | 14 | ## Arguments 15 | 16 | name | type | description 17 | ----------------|----------|------------ 18 | updateCallback | function | the function called every time the stream updates. This function is optional. 19 | 20 | 21 | The update callback function takes 1 parameter: the metadata (see the [`on` method]({{site.baseurl}}/documentation/api_streamhelper/on.html)). 22 | 23 | ## Example 24 | 25 | ```js 26 | zip 27 | .generateInternalStream({type:"uint8array"}) 28 | .accumulate(function updateCallback(metadata) { 29 | // metadata contains for example currentFile and percent, see the generateInternalStream doc. 30 | }).then(function (data) { 31 | // data contains here the complete zip file as a uint8array (the type asked in generateInternalStream) 32 | }); 33 | ``` 34 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_streamhelper/on.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "on(event, callback)" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Register a listener on an event. 8 | 9 | __Returns__ : The current StreamHelper object, for chaining. 10 | 11 | __Throws__ : An exception if the event is unknown. 12 | 13 | ## Arguments 14 | 15 | name | type | description 16 | ----------|----------|------------ 17 | event | string | the name of the event. Only 3 events are supported : `data`, `end` and `error`. 18 | callback | function | the function called when the event occurs. See below for the arguments. 19 | 20 | The callbacks are executed in with the current `StreamHelper` as `this`. 21 | 22 | ### `data` callback 23 | 24 | It takes 2 parameters: 25 | 26 | - the current chunk of data (in a format specified by the method which 27 | generated this StreamHelper) 28 | - the metadata (see each method to know what's inside) 29 | 30 | ### `end` callback 31 | 32 | It does not take any parameter. 33 | 34 | ### `error` callback 35 | 36 | It takes an `Error` as parameter. 37 | 38 | ## Example 39 | 40 | ```js 41 | zip 42 | .generateInternalStream({type:"uint8array"}) 43 | .on('data', function (data, metadata) { 44 | // data is a Uint8Array because that's the type asked in generateInternalStream 45 | // metadata contains for example currentFile and percent, see the generateInternalStream doc. 46 | }) 47 | .on('error', function (e) { 48 | // e is the error 49 | }) 50 | .on('end', function () { 51 | // no parameter 52 | }) 53 | .resume(); 54 | ``` 55 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_streamhelper/pause.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "pause()" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Pause the stream if the stream is running. Once paused, the 8 | stream stops sending `data` events. 9 | 10 | __Returns__ : The current StreamHelper object, for chaining. 11 | 12 | ## Example 13 | 14 | ```js 15 | zip 16 | .generateInternalStream({type:"uint8array"}) 17 | .on('data', function(chunk) { 18 | 19 | // if we push the chunk to an other service which is overloaded, we can 20 | // pause the stream as backpressure. 21 | this.pause(); 22 | 23 | }).resume(); // start the stream the first time 24 | ``` 25 | 26 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_streamhelper/resume.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "resume()" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Resume the stream if the stream is paused. Once resumed, the stream starts 8 | sending `data` events again. 9 | 10 | __Returns__ : The current StreamHelper object, for chaining. 11 | 12 | __Since__: v3.0.0 13 | 14 | ## Example 15 | 16 | ```js 17 | zip 18 | .generateInternalStream({type:"uint8array"}) 19 | .on('data', function() {...}) 20 | .resume(); 21 | ``` 22 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_zipobject.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "ZipObject API" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | This represents an entry in the zip file. If the entry comes from an existing 8 | archive previously [loaded]({{site.baseurl}}/documentation/api_jszip/load_async.html), the content 9 | will be automatically decompressed/converted first. 10 | 11 | ### Attributes 12 | 13 | attribute name | type | description 14 | ----------------------------|-------------|------------- 15 | `name` | string | the absolute path of the file 16 | `dir` | boolean | true if this is a directory 17 | `date` | date | the last modification date 18 | `comment` | string | the comment for this file 19 | `unixPermissions` | 16 bits number | The UNIX permissions of the file, if any. 20 | `dosPermissions` | 6 bits number | The DOS permissions of the file, if any. 21 | `options` | object | the options of the file. The available options are : 22 | `options.compression` | compression | see [file(name, data [,options])]({{site.baseurl}}/documentation/api_jszip/file_data.html) 23 | 24 | Example: 25 | 26 | ```js 27 | { name: 'docs/', 28 | dir: true, 29 | date: 2016-12-25T08:09:27.153Z, 30 | comment: null, 31 | unixPermissions: 16877, 32 | dosPermissions: null, 33 | options: { 34 | compression: 'STORE', 35 | compressionOptions: null 36 | } 37 | } 38 | ``` 39 | 40 | ```js 41 | { name: 'docs/list.txt', 42 | dir: false, 43 | date: 2016-12-25T08:09:27.152Z, 44 | comment: null, 45 | unixPermissions: 33206, 46 | dosPermissions: null, 47 | options: { 48 | compression: 'DEFLATE', 49 | compressionOptions: null 50 | } 51 | } 52 | ``` 53 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_zipobject/async.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "async(type[, onUpdate])" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) of the content in the asked type. 8 | 9 | __Returns__ : A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) of the content. 10 | 11 | __Since__: v3.0.0 12 | 13 | ## Arguments 14 | 15 | name | type | description 16 | ---------|----------|------------ 17 | type | String | the type of the result. [More](#type-option). 18 | onUpdate | Function | an optional function called on each internal update with the metadata. [More](#onupdate-callback). 19 | 20 | ### `type` option 21 | 22 | Possible values for `type` : 23 | 24 | * `base64` : the result will be a string, the binary in a base64 form. 25 | * `text` (or `string`): the result will be an unicode string. 26 | * `binarystring`: the result will be a string in "binary" form, using 1 byte per char (2 bytes). 27 | * `array`: the result will be an Array of bytes (numbers between 0 and 255). 28 | * `uint8array` : the result will be a Uint8Array. This requires a compatible browser. 29 | * `arraybuffer` : the result will be a ArrayBuffer. This requires a compatible browser. 30 | * `blob` : the result will be a Blob. This requires a compatible browser. 31 | * `nodebuffer` : the result will be a nodejs Buffer. This requires nodejs. 32 | 33 | Note : when using type = "uint8array", "arraybuffer" or "blob", be sure to 34 | check if the browser supports it (you can use [`JSZip.support`]({{site.baseurl}}/documentation/api_jszip/support.html)). 35 | 36 | ```js 37 | zip.file("image.png").async("uint8array").then(function (u8) { 38 | // ... 39 | }); 40 | ``` 41 | 42 | ### `onUpdate` callback 43 | 44 | If specified, this function will be called each time a chunk is pushed to the 45 | output stream (or internally accumulated). 46 | 47 | The function takes a `metadata` object which contains informations about the 48 | ongoing process. 49 | 50 | __Metadata__ : the metadata are : 51 | 52 | name | type | description 53 | ------------|--------|------------ 54 | percent | number | the percent of completion (a double between 0 and 100) 55 | 56 | ```js 57 | zip.file("image.png").async("uint8array", function updateCallback(metadata) { 58 | console.log("progression: " + metadata.percent.toFixed(2) + " %"); 59 | }).then(function (u8) { 60 | // ... 61 | }) 62 | ``` 63 | 64 | 65 | ## Other examples 66 | 67 | ```js 68 | zip 69 | .file("my_text.txt") 70 | .async("string") 71 | .then(function success(content) { 72 | // use the content 73 | }, function error(e) { 74 | // handle the error 75 | }); 76 | ``` 77 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_zipobject/internal_stream.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "internalStream(type)" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Return a [StreamHelper]({{site.baseurl}}/documentation/api_streamhelper.html) 8 | of the content in the asked type. 9 | 10 | __Returns__ : a [StreamHelper]({{site.baseurl}}/documentation/api_streamhelper.html) 11 | of the content in the asked type. 12 | 13 | ## Arguments 14 | 15 | name | type | description 16 | ---------|----------|------------ 17 | type | String | the type of the result: `string`, `binarystring`, `uint8array`, `arraybuffer`, `nodebuffer`. 18 | 19 | 20 | ## Example 21 | 22 | ```js 23 | zip 24 | .file("my_text.txt") 25 | .internalStream("string") 26 | .on("data", function (data) {...}) 27 | .on("error", function (e) {...}) 28 | .on("end", function () {...}); 29 | ``` 30 | 31 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/api_zipobject/node_stream.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "nodeStream(type[, onUpdate])" 3 | layout: default 4 | section: api 5 | --- 6 | 7 | Return a [nodejs Streams3](https://github.com/nodejs/readable-stream) 8 | of the content in the asked type. 9 | 10 | __Returns__ : a [nodejs Streams3](https://github.com/nodejs/readable-stream). 11 | 12 | ## Arguments 13 | 14 | name | type | default | description 15 | ---------|----------|--------------|------------ 16 | type | String | `nodebuffer` | only `nodebuffer` is currently supported. 17 | onUpdate | Function | | an optional function called on each internal update with the metadata. 18 | 19 | __Metadata__ : see [the metadata of `async()`]({{site.baseurl}}/documentation/api_zipobject/async.html#onupdate-callback). 20 | 21 | ## Example 22 | 23 | ```js 24 | zip 25 | .file("my_text.txt") 26 | .nodeStream() 27 | .pipe(fs.createWriteStream('/tmp/my_text.txt')) 28 | .on('finish', function () { 29 | // JSZip generates a readable stream with a "end" event, 30 | // but is piped here in a writable stream which emits a "finish" event. 31 | console.log("text file written."); 32 | }); 33 | ``` 34 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/contributing.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Contributing 3 | layout: default 4 | section: main 5 | --- 6 | 7 | 8 | ### Download the sources 9 | 10 | You should create a [Github](https://github.com/) account and 11 | [fork the repository](https://help.github.com/articles/fork-a-repo) (you will 12 | need one to create the pull request). 13 | 14 | If you just want the get the source code, you can use git and do 15 | `git clone https://github.com/Stuk/jszip.git` to get the sources. You can also 16 | download the latest sources [here](https://github.com/Stuk/jszip/archive/master.zip). 17 | 18 | ### Building the project 19 | 20 | #### Code 21 | 22 | The dependencies are handled by npm, the first step is to run 23 | `npm install` to get the dependencies. 24 | JSZip uses Grunt to handle the build, [see here to install its CLI](http://gruntjs.com/getting-started). 25 | 26 | Here are the interesting build commands : 27 | 28 | * `grunt` will generate the final js file in dist/ and the minified version. 29 | * `npm run test-node` will run the tests in nodejs. 30 | * `npm run test-browser` will the tests in some browsers using SauceLabs, see 31 | below. 32 | * `npm run test` will run the tests in nodejs and in the browser. 33 | * `npm run lint` will use jshint the check the source code. 34 | 35 | #### Documentation 36 | 37 | The documentation uses jekyll on gh-pages. To render the documentation, you 38 | need to [install jekyll](http://jekyllrb.com/docs/installation/) and then run 39 | `jekyll serve --baseurl ''`. 40 | 41 | ### Testing the project 42 | 43 | To test JSZip in nodejs, use `npm run test-node`. 44 | 45 | To test JSZip in a browser, you can open the file `test/index.html` in the 46 | browser you want to test. Don't forget to update the dist/ files with `grunt`. 47 | 48 | You can also test JSZip in a lot of browsers at once with 49 | [SauceLabs](https://saucelabs.com/). You will need a SauceLabs account and two 50 | variables into your environment. On linux, just use 51 | 52 | ```bash 53 | export SAUCE_USERNAME=your-saucelabs-username 54 | export SAUCE_ACCESS_KEY=your-saucelabs-access-key 55 | ``` 56 | 57 | before running the `npm run test-browser` command. 58 | 59 | ### Merging the changes 60 | 61 | If you have tested bug fixes or new features, you can open a 62 | [pull request](https://help.github.com/articles/using-pull-requests) on Github. 63 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/css/main.css: -------------------------------------------------------------------------------- 1 | ul.nav ul { 2 | list-style:none; 3 | margin: 0; 4 | padding: 0 0 0 25px; 5 | } 6 | 7 | #downloader_application form { 8 | margin-bottom: 10px; 9 | } 10 | 11 | #downloader_application ul { 12 | list-style-type: none; 13 | } 14 | 15 | .browser_support th { 16 | border-bottom-width: 3px !important; 17 | } 18 | 19 | .support_ie {border-bottom-color: #0275BA !important;} 20 | .support_ff {border-bottom-color: #DF7215 !important;} 21 | .support_sf {border-bottom-color: #43B3E9 !important;} 22 | .support_cr {border-bottom-color: #39B642 !important;} 23 | .support_op {border-bottom-color: #C42122 !important;} 24 | .support_nd {border-bottom-color: #8CC84B !important;} 25 | 26 | .show-example { 27 | padding: 10px; 28 | border: 1px solid #ccc; 29 | border-radius: 4px; 30 | margin: 0 0 10px; 31 | } 32 | 33 | .tab-pane > figure.highlight > pre, .tab-pane > .show-example { 34 | border-radius: 0 0 4px 4px; 35 | border-top: 0px; 36 | } 37 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/css/pygments.css: -------------------------------------------------------------------------------- 1 | /* Generated with : 2 | * pygmentize -S default -f html > pygments.css 3 | */ 4 | .hll { background-color: #ffffcc } 5 | .c { color: #408080; font-style: italic } /* Comment */ 6 | .err { border: 1px solid #FF0000 } /* Error */ 7 | .k { color: #008000; font-weight: bold } /* Keyword */ 8 | .o { color: #666666 } /* Operator */ 9 | .cm { color: #408080; font-style: italic } /* Comment.Multiline */ 10 | .cp { color: #BC7A00 } /* Comment.Preproc */ 11 | .c1 { color: #408080; font-style: italic } /* Comment.Single */ 12 | .cs { color: #408080; font-style: italic } /* Comment.Special */ 13 | .gd { color: #A00000 } /* Generic.Deleted */ 14 | .ge { font-style: italic } /* Generic.Emph */ 15 | .gr { color: #FF0000 } /* Generic.Error */ 16 | .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 17 | .gi { color: #00A000 } /* Generic.Inserted */ 18 | .go { color: #888888 } /* Generic.Output */ 19 | .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ 20 | .gs { font-weight: bold } /* Generic.Strong */ 21 | .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 22 | .gt { color: #0044DD } /* Generic.Traceback */ 23 | .kc { color: #008000; font-weight: bold } /* Keyword.Constant */ 24 | .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ 25 | .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ 26 | .kp { color: #008000 } /* Keyword.Pseudo */ 27 | .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ 28 | .kt { color: #B00040 } /* Keyword.Type */ 29 | .m { color: #666666 } /* Literal.Number */ 30 | .s { color: #BA2121 } /* Literal.String */ 31 | .na { color: #7D9029 } /* Name.Attribute */ 32 | .nb { color: #008000 } /* Name.Builtin */ 33 | .nc { color: #0000FF; font-weight: bold } /* Name.Class */ 34 | .no { color: #880000 } /* Name.Constant */ 35 | .nd { color: #AA22FF } /* Name.Decorator */ 36 | .ni { color: #999999; font-weight: bold } /* Name.Entity */ 37 | .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ 38 | .nf { color: #0000FF } /* Name.Function */ 39 | .nl { color: #A0A000 } /* Name.Label */ 40 | .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ 41 | .nt { color: #008000; font-weight: bold } /* Name.Tag */ 42 | .nv { color: #19177C } /* Name.Variable */ 43 | .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ 44 | .w { color: #bbbbbb } /* Text.Whitespace */ 45 | .mf { color: #666666 } /* Literal.Number.Float */ 46 | .mh { color: #666666 } /* Literal.Number.Hex */ 47 | .mi { color: #666666 } /* Literal.Number.Integer */ 48 | .mo { color: #666666 } /* Literal.Number.Oct */ 49 | .sb { color: #BA2121 } /* Literal.String.Backtick */ 50 | .sc { color: #BA2121 } /* Literal.String.Char */ 51 | .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ 52 | .s2 { color: #BA2121 } /* Literal.String.Double */ 53 | .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ 54 | .sh { color: #BA2121 } /* Literal.String.Heredoc */ 55 | .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ 56 | .sx { color: #008000 } /* Literal.String.Other */ 57 | .sr { color: #BB6688 } /* Literal.String.Regex */ 58 | .s1 { color: #BA2121 } /* Literal.String.Single */ 59 | .ss { color: #19177C } /* Literal.String.Symbol */ 60 | .bp { color: #008000 } /* Name.Builtin.Pseudo */ 61 | .vc { color: #19177C } /* Name.Variable.Class */ 62 | .vg { color: #19177C } /* Name.Variable.Global */ 63 | .vi { color: #19177C } /* Name.Variable.Instance */ 64 | .il { color: #666666 } /* Literal.Number.Integer.Long */ 65 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "How to use JSZip" 3 | layout: default 4 | section: example 5 | --- 6 | 7 | An instance of JSZip represents a set of files. You can add them, remove them, 8 | modify them. You can also import an existing zip file or generate one. 9 | 10 | ### Getting the object 11 | 12 | #### In a browser 13 | 14 | For a browser, there are two interesting files : `dist/jszip.js` and 15 | `dist/jszip.min.js` (include just one). 16 | 17 | If you use an AMD loader (RequireJS for example) JSZip will register itself : 18 | you just have to put the js file at the right place, or configure the loader 19 | (see [here for RequireJS](http://requirejs.org/docs/api.html#config-paths)). 20 | 21 | Without any loader, JSZip will declare in the global scope a variable named `JSZip`. 22 | 23 | #### In nodejs 24 | 25 | In nodejs, you can `require` it : 26 | 27 | ```js 28 | var JSZip = require("jszip"); 29 | ``` 30 | 31 | ### Basic manipulations 32 | 33 | The first step is to create an instance of JSZip : 34 | 35 | ```js 36 | var zip = new JSZip(); 37 | ``` 38 | 39 | On this instance, we can add (and update) files and folders with 40 | `.file(name, content)` and `.folder(name)`. 41 | They return the current JSZip instance so you can chain the calls. 42 | 43 | ```js 44 | // create a file 45 | zip.file("hello.txt", "Hello[p my)6cxsw2q"); 46 | // oops, cat on keyboard. Fixing ! 47 | zip.file("hello.txt", "Hello World\n"); 48 | 49 | // create a file and a folder 50 | zip.file("nested/hello.txt", "Hello World\n"); 51 | // same as 52 | zip.folder("nested").file("hello.txt", "Hello World\n"); 53 | ``` 54 | 55 | With `.folder(name)`, the returned object has a different root : if you add files 56 | on this object, you will put them in the created subfolder. This is just a 57 | view, the added files will also be in the "root" object. 58 | 59 | ```js 60 | var photoZip = zip.folder("photos"); 61 | // this call will create photos/README 62 | photoZip.file("README", "a folder with photos"); 63 | ``` 64 | 65 | You can access the file content with `.file(name)` and 66 | [its getters]({{site.baseurl}}/documentation/api_zipobject.html) : 67 | 68 | ```js 69 | zip.file("hello.txt").async("string").then(function (data) { 70 | // data is "Hello World\n" 71 | }); 72 | 73 | if (JSZip.support.uint8array) { 74 | zip.file("hello.txt").async("uint8array").then(function (data) { 75 | // data is Uint8Array { 0=72, 1=101, 2=108, more...} 76 | }); 77 | } 78 | ``` 79 | 80 | You can also remove files or folders with `.remove(name)` : 81 | 82 | ```js 83 | zip.remove("photos/README"); 84 | zip.remove("photos"); 85 | // same as 86 | zip.remove("photos"); // by removing the folder, you also remove its content. 87 | ``` 88 | 89 | ### Generate a zip file 90 | 91 | With `.generateAsync(options)` or `.generateNodeStream(options)` you can generate 92 | a zip file (not a real file but its representation in memory). Check 93 | [this page]({{site.baseurl}}/documentation/howto/write_zip.html) for more 94 | informations on how to write / give the file to the user. 95 | 96 | ```js 97 | var promise = null; 98 | if (JSZip.support.uint8array) { 99 | promise = zip.generateAsync({type : "uint8array"}); 100 | } else { 101 | promise = zip.generateAsync({type : "string"}); 102 | } 103 | ``` 104 | 105 | ### Read a zip file 106 | 107 | With `.loadAsync(data)` you can load a zip file. Check 108 | [this page]({{site.baseurl}}/documentation/howto/read_zip.html) to see how to 109 | do properly (it's more tricky that it seems). 110 | 111 | ```js 112 | var new_zip = new JSZip(); 113 | // more files ! 114 | new_zip.loadAsync(content) 115 | .then(function(zip) { 116 | // you now have every files contained in the loaded zip 117 | new_zip.file("hello.txt").async("string"); // a promise of "Hello World\n" 118 | }); 119 | ``` 120 | 121 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/download-zip-file.html: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Download the generated zip file" 3 | layout: default 4 | section: example 5 | --- 6 | 7 |

The FileSaver API

8 | 25 |
26 |
27 |
28 | {% include_relative download-zip-file.inc/blob.html %} 29 |
30 |
31 |
32 | {% highlight js %} 33 | {% include_relative download-zip-file.inc/blob.js %} 34 | {% endhighlight %} 35 |
36 |
37 | {% highlight html %} 38 | {% include_relative download-zip-file.inc/blob.html %} 39 | {% endhighlight %} 40 |
41 |
42 | 43 |

The data URL

44 | 61 |
62 |
63 |
64 | {% include_relative download-zip-file.inc/data_uri.html %} 65 |
66 |
67 |
68 | {% highlight js %} 69 | {% include_relative download-zip-file.inc/data_uri.js %} 70 | {% endhighlight %} 71 |
72 |
73 | {% highlight html %} 74 | {% include_relative download-zip-file.inc/data_uri.html %} 75 | {% endhighlight %} 76 |
77 |
78 | 79 | 94 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/download-zip-file.inc/blob.html: -------------------------------------------------------------------------------- 1 |

Works on firefox, chrome , opera >= 15 and IE >= 10 (but NOT in compatibility view).

2 | 3 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/download-zip-file.inc/blob.js: -------------------------------------------------------------------------------- 1 | var zip = new JSZip(); 2 | zip.file("Hello.txt", "Hello world\n"); 3 | 4 | jQuery("#blob").on("click", function () { 5 | zip.generateAsync({type:"blob"}).then(function (blob) { // 1) generate the zip file 6 | saveAs(blob, "hello.zip"); // 2) trigger the download 7 | }, function (err) { 8 | jQuery("#blob").text(err); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/download-zip-file.inc/data_uri.html: -------------------------------------------------------------------------------- 1 |

Does not work in IE, has restrictions on the length.

2 | 3 | 4 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/download-zip-file.inc/data_uri.js: -------------------------------------------------------------------------------- 1 | var zip = new JSZip(); 2 | zip.file("Hello.txt", "Hello world\n"); 3 | 4 | jQuery("#data_uri").on("click", function () { 5 | zip.generateAsync({type:"base64"}).then(function (base64) { 6 | window.location = "data:application/zip;base64," + base64; 7 | }, function (err) { 8 | jQuery("#data_uri").text(err); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/downloader.html: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Mini app : Downloader" 3 | layout: default 4 | section: example 5 | --- 6 | 7 |

8 | This mini application let you choose the files you want in a list, download 9 | them, zip them and give the result to the user. 10 |

11 |

12 | This demo requires a recent browser, see 13 | the howto. 14 |

15 |

16 | This demo depends on the following libraries: 17 |

22 |

23 | 24 | 25 | 47 |
48 |
49 |
50 |
51 | {% include_relative downloader.inc/downloader.html %} 52 |
53 |
54 |
55 |
56 | {% highlight js %} 57 | {% include_relative downloader.inc/downloader.js %} 58 | {% endhighlight %} 59 |
60 |
61 | {% highlight js %} 62 | {% include_relative downloader.inc/helpers.js %} 63 | {% endhighlight %} 64 |
65 |
66 | {% highlight html %} 67 | {% include_relative downloader.inc/downloader.html %} 68 | {% endhighlight %} 69 |
70 |
71 | 72 | 78 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/downloader.inc/downloader.html: -------------------------------------------------------------------------------- 1 |

Please select your files

2 |
3 |
    4 |
  • 5 | 9 |
  • 10 |
  • 11 | 15 |
  • 16 |
  • 17 | 21 |
  • 22 |
  • 23 | 27 |
  • 28 |
29 | 30 | 31 |
32 | 33 |
34 |
35 |
36 |
37 | 38 |

39 | 40 | 41 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/downloader.inc/downloader.js: -------------------------------------------------------------------------------- 1 | 2 | var Promise = window.Promise; 3 | if (!Promise) { 4 | Promise = JSZip.external.Promise; 5 | } 6 | 7 | /** 8 | * Fetch the content and return the associated promise. 9 | * @param {String} url the url of the content to fetch. 10 | * @return {Promise} the promise containing the data. 11 | */ 12 | function urlToPromise(url) { 13 | return new Promise(function(resolve, reject) { 14 | JSZipUtils.getBinaryContent(url, function (err, data) { 15 | if(err) { 16 | reject(err); 17 | } else { 18 | resolve(data); 19 | } 20 | }); 21 | }); 22 | } 23 | 24 | var $form = $("#download_form").on("submit", function () { 25 | 26 | resetMessage(); 27 | 28 | var zip = new JSZip(); 29 | 30 | // find every checked item 31 | $(this).find(":checked").each(function () { 32 | var $this = $(this); 33 | var url = $this.data("url"); 34 | var filename = url.replace(/.*\//g, ""); 35 | zip.file(filename, urlToPromise(url), {binary:true}); 36 | }); 37 | 38 | // when everything has been downloaded, we can trigger the dl 39 | zip.generateAsync({type:"blob"}, function updateCallback(metadata) { 40 | var msg = "progression : " + metadata.percent.toFixed(2) + " %"; 41 | if(metadata.currentFile) { 42 | msg += ", current file = " + metadata.currentFile; 43 | } 44 | showMessage(msg); 45 | updatePercent(metadata.percent|0); 46 | }) 47 | .then(function callback(blob) { 48 | 49 | // see FileSaver.js 50 | saveAs(blob, "example.zip"); 51 | 52 | showMessage("done !"); 53 | }, function (e) { 54 | showError(e); 55 | }); 56 | 57 | return false; 58 | }); 59 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/downloader.inc/helpers.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Reset the message. 3 | */ 4 | function resetMessage () { 5 | $("#result") 6 | .removeClass() 7 | .text(""); 8 | } 9 | /** 10 | * show a successful message. 11 | * @param {String} text the text to show. 12 | */ 13 | function showMessage(text) { 14 | resetMessage(); 15 | $("#result") 16 | .addClass("alert alert-success") 17 | .text(text); 18 | } 19 | /** 20 | * show an error message. 21 | * @param {String} text the text to show. 22 | */ 23 | function showError(text) { 24 | resetMessage(); 25 | $("#result") 26 | .addClass("alert alert-danger") 27 | .text(text); 28 | } 29 | /** 30 | * Update the progress bar. 31 | * @param {Integer} percent the current percent 32 | */ 33 | function updatePercent(percent) { 34 | $("#progress_bar").removeClass("hide") 35 | .find(".progress-bar") 36 | .attr("aria-valuenow", percent) 37 | .css({ 38 | width : percent + "%" 39 | }); 40 | } 41 | 42 | if(!JSZip.support.blob) { 43 | showError("This demo works only with a recent browser !"); 44 | return; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/get-binary-files-ajax.html: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Get a file with an ajax call" 3 | layout: default 4 | section: example 5 | --- 6 | 7 |

With JSZipUtils

8 | 9 | Note: JSZipUtils is a library available here. 10 | 11 | 28 |
29 |
30 |
31 | {% include_relative get-binary-files-ajax.inc/jszip_utils.html %} 32 |
33 |
34 |
35 | {% highlight js %} 36 | {% include_relative get-binary-files-ajax.inc/jszip_utils.js %} 37 | {% endhighlight %} 38 |
39 |
40 | {% highlight html %} 41 | {% include_relative get-binary-files-ajax.inc/jszip_utils.html %} 42 | {% endhighlight %} 43 |
44 |
45 | 46 |

With the Fetch API

47 | 48 | Note: the 49 | Fetch API is a new javascript API which may not be available everywhere. 50 | 51 | 68 |
69 |
70 |
71 | {% include_relative get-binary-files-ajax.inc/fetch_api.html %} 72 |
73 |
74 |
75 | {% highlight js %} 76 | {% include_relative get-binary-files-ajax.inc/fetch_api.js %} 77 | {% endhighlight %} 78 |
79 |
80 | {% highlight html %} 81 | {% include_relative get-binary-files-ajax.inc/fetch_api.html %} 82 | {% endhighlight %} 83 |
84 |
85 | 86 | 113 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/get-binary-files-ajax.inc/fetch_api.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/get-binary-files-ajax.inc/fetch_api.js: -------------------------------------------------------------------------------- 1 | fetch('{{site.baseurl}}/test/ref/text.zip') // 1) fetch the url 2 | .then(function (response) { // 2) filter on 200 OK 3 | if (response.status === 200 || response.status === 0) { 4 | return Promise.resolve(response.blob()); 5 | } else { 6 | return Promise.reject(new Error(response.statusText)); 7 | } 8 | }) 9 | .then(JSZip.loadAsync) // 3) chain with the zip promise 10 | .then(function (zip) { 11 | return zip.file("Hello.txt").async("string"); // 4) chain with the text content promise 12 | }) 13 | .then(function success(text) { // 5) display the result 14 | $("#fetch").append($("

", { 15 | "class": "alert alert-success", 16 | text: "loaded, content = " + text 17 | })); 18 | }, function error(e) { 19 | $("#fetch").append($("

", { 20 | "class": "alert alert-danger", 21 | text: e 22 | })); 23 | }); 24 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/get-binary-files-ajax.inc/jszip_utils.html: -------------------------------------------------------------------------------- 1 |

2 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/get-binary-files-ajax.inc/jszip_utils.js: -------------------------------------------------------------------------------- 1 | // 1) get a promise of the content 2 | var promise = new JSZip.external.Promise(function (resolve, reject) { 3 | JSZipUtils.getBinaryContent('{{site.baseurl}}/test/ref/text.zip', function(err, data) { 4 | if (err) { 5 | reject(err); 6 | } else { 7 | resolve(data); 8 | } 9 | }); 10 | }); 11 | 12 | promise.then(JSZip.loadAsync) // 2) chain with the zip promise 13 | .then(function(zip) { 14 | return zip.file("Hello.txt").async("string"); // 3) chain with the text content promise 15 | }) 16 | .then(function success(text) { // 4) display the result 17 | $("#jszip_utils").append($("

", { 18 | "class": "alert alert-success", 19 | text: "loaded, content = " + text 20 | })); 21 | }, function error(e) { 22 | $("#jszip_utils").append($("

", { 23 | "class": "alert alert-danger", 24 | text: e 25 | })); 26 | }); 27 | 28 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/read-local-file-api.html: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Reading a local file with the File API" 3 | layout: default 4 | section: example 5 | --- 6 | 7 |

24 |
25 |
26 |
27 | {% include_relative read-local-file-api.inc/read.html %} 28 |
29 |
30 |
31 | {% highlight js %} 32 | {% include_relative read-local-file-api.inc/read.js %} 33 | {% endhighlight %} 34 |
35 |
36 | {% highlight html %} 37 | {% include_relative read-local-file-api.inc/read.html %} 38 | {% endhighlight %} 39 |
40 |
41 | 42 | 45 | 56 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/read-local-file-api.inc/read.html: -------------------------------------------------------------------------------- 1 |

Choose the local(s) zip file(s)

2 |

Note : your browser will process the zip file, don't choose a file too big !

3 |
4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/examples/read-local-file-api.inc/read.js: -------------------------------------------------------------------------------- 1 | var $result = $("#result"); 2 | $("#file").on("change", function(evt) { 3 | // remove content 4 | $result.html(""); 5 | // be sure to show the results 6 | $("#result_block").removeClass("hidden").addClass("show"); 7 | 8 | // Closure to capture the file information. 9 | function handleFile(f) { 10 | var $title = $("

", { 11 | text : f.name 12 | }); 13 | var $fileContent = $("
    "); 14 | $result.append($title); 15 | $result.append($fileContent); 16 | 17 | var dateBefore = new Date(); 18 | JSZip.loadAsync(f) // 1) read the Blob 19 | .then(function(zip) { 20 | var dateAfter = new Date(); 21 | $title.append($("", { 22 | "class": "small", 23 | text:" (loaded in " + (dateAfter - dateBefore) + "ms)" 24 | })); 25 | 26 | zip.forEach(function (relativePath, zipEntry) { // 2) print entries 27 | $fileContent.append($("
  • ", { 28 | text : zipEntry.name 29 | })); 30 | }); 31 | }, function (e) { 32 | $result.append($("
    ", { 33 | "class" : "alert alert-danger", 34 | text : "Error reading " + f.name + ": " + e.message 35 | })); 36 | }); 37 | } 38 | 39 | var files = evt.target.files; 40 | for (var i = 0; i < files.length; i++) { 41 | handleFile(files[i]); 42 | } 43 | }); 44 | 45 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/faq.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Frequently Asked Questions" 3 | layout: default 4 | section: main 5 | --- 6 | 7 | ### "Corrupted zip or bug: unexpected signature" 8 | 9 | If you are sure that the zip file is correct, that error often comes from a 10 | corrupted content. An ajax request, if not prepared correctly, will try to 11 | decode the binary content as a text and corrupt it. See 12 | [this page]({{site.baseurl}}/documentation/howto/read_zip.html). 13 | 14 | ### My browser crashes / becomes unresponsive / never finish the execution 15 | 16 | That happens if you try to handle to much data with the synchronous API. If 17 | possible, try the asynchronous API, see 18 | [this page]({{site.baseurl}}/documentation/limitations.html) for more informations. 19 | 20 | ### Can't read the data of [...]. Is it in a supported JavaScript type ? 21 | 22 | Or the old message: 23 | 24 | > The data of [...] is in an unsupported format 25 | 26 | The method [`file(name, data [,options])`]({{site.baseurl}}/documentation/api_jszip/file_data.html) 27 | accepts string and binary inputs for `data`. 28 | 29 | If you use an unsupported type, an object for example, you will get this error: 30 | 31 | ```js 32 | // WRONG 33 | var data = { 34 | content: new ArrayBuffer(...) 35 | }; 36 | zip.file("my.data", data); // won't work, data is an object 37 | 38 | // CORRECT 39 | var data = new ArrayBuffer(...); 40 | zip.file("my.data", data); // will work, JSZip accepts ArrayBuffer 41 | ``` 42 | 43 | ### My mac generates a `.cpgz` file when I try to extract the zip file 44 | 45 | MacOS Finder has a lot of bug related to zip files (the `unzip` command line 46 | tool is fine). When something goes wrong, Finder will generate this cpgz file 47 | instead of showing an error. 48 | 49 | To get a correct result, try to enable compression in `generateAsync`: 50 | 51 | ```js 52 | zip.generateAsync({ 53 | type:"...", 54 | compression: "DEFLATE" // <-- here 55 | }); 56 | ``` 57 | 58 | Using `platform: "UNIX"` may help too. 59 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/howto/read_zip.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "How to read a file" 3 | layout: default 4 | section: example 5 | --- 6 | 7 | This page explains how to read an existing zip file or add a existing file into 8 | the zip file. 9 | 10 | 11 | ### In the browser 12 | 13 | #### AJAX request 14 | 15 | Getting binary data with an ajax request is hard (mainly because of IE <= 9). 16 | The easy way is to use [JSZipUtils.getBinaryContent](https://github.com/stuk/jszip-utils). 17 | With JSZipUtils.getBinaryContent, you can do the following (see the 18 | documentation for more examples) : 19 | 20 | ```js 21 | JSZipUtils.getBinaryContent('path/to/content.zip', function(err, data) { 22 | if(err) { 23 | throw err; // or handle err 24 | } 25 | 26 | JSZip.loadAsync(data).then(function () { 27 | // ... 28 | }); 29 | }); 30 | 31 | // or, with promises: 32 | 33 | new JSZip.external.Promise(function (resolve, reject) { 34 | JSZipUtils.getBinaryContent('path/to/content.zip', function(err, data) { 35 | if (err) { 36 | reject(err); 37 | } else { 38 | resolve(data); 39 | } 40 | }); 41 | }).then(function (data) { 42 | return JSZip.loadAsync(data); 43 | }) 44 | .then(...) 45 | ``` 46 | 47 |
    48 | 49 | If you need to adapt an existing solution to what getBinaryContent does, here 50 | are the details. When doing a XHR request (level 1, without setting the 51 | `responseType`) the browser will try to interpret the response as a string and 52 | decode it from its charset. To avoid this on Firefox/Chrome/Opera, you need to 53 | set mime type : `xhr.overrideMimeType("text/plain; charset=x-user-defined");`. 54 | On IE <= 9, this is harder. The overrideMimeType trick doesn't work so we need 55 | to use [vbscript](http://stackoverflow.com/questions/1095102/how-do-i-load-binary-image-data-using-javascript-and-xmlhttprequest) 56 | and non standard attributes. 57 | On IE > 9, overrideMimeType doesn't work but xhr2 does. 58 | 59 | With [xhr 2](http://caniuse.com/xhr2), you can just set the responseType 60 | attribute : `xhr.responseType = "arraybuffer";`. With this, the browser will 61 | return an ArrayBuffer. 62 | 63 | #### Local files 64 | 65 | If the browser supports the [FileReader API](http://caniuse.com/filereader), 66 | you can use it to read a zip file. JSZip can read ArrayBuffer, so you can use 67 | `FileReader.readAsArrayBuffer(Blob)`, see this [example]({{site.baseurl}}/documentation/examples/read-local-file-api.html). 68 | 69 | ### In nodejs 70 | 71 | JSZip can read Buffers so you can do the following : 72 | 73 | #### Local file 74 | 75 | ```js 76 | "use strict"; 77 | 78 | var fs = require("fs"); 79 | var JSZip = require("jszip"); 80 | 81 | // read a zip file 82 | fs.readFile("test.zip", function(err, data) { 83 | if (err) throw err; 84 | JSZip.loadAsync(data).then(function (zip) { 85 | // ... 86 | }); 87 | }); 88 | // or 89 | new JSZip.external.Promise(function (resolve, reject) { 90 | fs.readFile("test.zip", function(err, data) { 91 | if (err) { 92 | reject(e); 93 | } else { 94 | resolve(data); 95 | } 96 | }); 97 | }).then(function (data) { 98 | return JSZip.loadAsync(data); 99 | }) 100 | .then(...) 101 | 102 | 103 | // read a file and add it to a zip 104 | fs.readFile("picture.png", function(err, data) { 105 | if (err) throw err; 106 | var zip = new JSZip(); 107 | zip.file("picture.png", data); 108 | }); 109 | // or 110 | var contentPromise = new JSZip.external.Promise(function (resolve, reject) { 111 | fs.readFile("picture.png", function(err, data) { 112 | if (err) { 113 | reject(e); 114 | } else { 115 | resolve(data); 116 | } 117 | }); 118 | }); 119 | zip.file("picture.png", contentPromise); 120 | 121 | 122 | // read a file as a stream and add it to a zip 123 | var stream = fs.createReadStream("picture.png"); 124 | zip.file("picture.png", stream); 125 | ``` 126 | 127 | #### Remote file 128 | 129 | There are a lot of nodejs libraries doing http requests, from the built-in 130 | [http](http://nodejs.org/docs/latest/api/http.html) to the 131 | [npm packages](https://www.npmjs.org/browse/keyword/http). Here are two 132 | examples, one with the default http API, the other with 133 | [request](https://github.com/mikeal/request) (but you're free to use your 134 | favorite library !). If possible, download the file as a Buffer (you will get 135 | better performances). If it's not possible, you can fallback to a binary string 136 | (the option is likely to be `encoding : "binary"`). 137 | 138 | ##### With http : 139 | 140 | ```js 141 | "use strict"; 142 | 143 | var http = require("http"); 144 | var url = require("url"); 145 | var JSZip = require("jszip"); 146 | 147 | var req = http.get(url.parse("http://localhost/.../file.zip"), function (res) { 148 | if (res.statusCode !== 200) { 149 | console.log(res.statusCode); 150 | // handle error 151 | return; 152 | } 153 | var data = [], dataLen = 0; 154 | 155 | // don't set the encoding, it will break everything ! 156 | // or, if you must, set it to null. In that case the chunk will be a string. 157 | 158 | res.on("data", function (chunk) { 159 | data.push(chunk); 160 | dataLen += chunk.length; 161 | }); 162 | 163 | res.on("end", function () { 164 | var buf = Buffer.concat(data); 165 | 166 | // here we go ! 167 | JSZip.loadAsync(buf).then(function (zip) { 168 | return zip.file("content.txt").async("string"); 169 | }).then(function (text) { 170 | console.log(text); 171 | }); 172 | }); 173 | }); 174 | 175 | req.on("error", function(err){ 176 | // handle error 177 | }); 178 | ``` 179 | 180 | ##### With request : 181 | 182 | ```js 183 | "use strict"; 184 | 185 | var request = require('request'); 186 | var JSZip = require("jszip"); 187 | 188 | request({ 189 | method : "GET", 190 | url : "http://localhost/.../file.zip", 191 | encoding: null // <- this one is important ! 192 | }, function (error, response, body) { 193 | if(error || response.statusCode !== 200) { 194 | // handle error 195 | return; 196 | } 197 | JSZip.loadAsync(body).then(function (zip) { 198 | return zip.file("content.txt").async("string"); 199 | }).then(function () { 200 | console.log(text); 201 | }); 202 | }); 203 | ``` 204 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/howto/write_zip.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "How to write a file / give it to the user" 3 | layout: default 4 | section: example 5 | --- 6 | 7 | ### In the browser 8 | 9 | With only javascript, this part won't work in old browsers, including IE < 10. 10 | For those browsers, you can use a flash polyfill, see below. 11 | 12 | You can also see this 13 | [example]({{site.baseurl}}/documentation/examples/download-zip-file.html). 14 | 15 | #### Blob URL / FileSaver 16 | 17 | With recent browsers, the easiest way is to use `saveAs` or a polyfill, see 18 | [FileSaver.js](https://github.com/eligrey/FileSaver.js) : 19 | 20 | ```js 21 | zip.generateAsync({type:"blob"}) 22 | .then(function (blob) { 23 | saveAs(blob, "hello.zip"); 24 | }); 25 | ``` 26 | 27 | Under the hood, the polyfill uses the native `saveAs` from the 28 | [FileSaver](http://www.w3.org/TR/file-writer-api/#the-filesaver-interface) API 29 | (on Chrome and IE10+) or use a [Blob URL](http://updates.html5rocks.com/2011/08/Downloading-resources-in-HTML5-a-download) 30 | (on Firefox). 31 | 32 | 33 | #### Data URI 34 | 35 | For older browsers that support [data URI](http://caniuse.com/datauri), you can also 36 | do the following : 37 | 38 | ```js 39 | zip.generateAsync({type:"base64"}).then(function (base64) { 40 | location.href="data:application/zip;base64," + base64; 41 | }); 42 | ``` 43 | 44 | The biggest issue here is that the filenames are very awkward, Firefox 45 | generates filenames such as `a5sZQRsx.zip.part` (see bugs 46 | [367231](https://bugzilla.mozilla.org/show_bug.cgi?id=367231) and 47 | [532230](https://bugzilla.mozilla.org/show_bug.cgi?id=532230), and Safari 48 | isn't much better with just `Unknown`. 49 | 50 | Browser support and resulting filename : 51 | 52 | Opera | Firefox | Safari | Chrome | Internet Explorer 53 | -------|---------|--------|--------|------------------ 54 | "default.zip" | random alphanumeric with ".part" extension | "Unknown" (no extension) | "download.zip" on OSX and Linux, just "download" on Windows | No 55 | 56 | #### Downloadify 57 | 58 | [Downloadify](https://github.com/dcneiner/downloadify) uses a small Flash SWF 59 | to download files to a user's computer with a filename that you can choose. 60 | Doug Neiner has added the `dataType` option to allow you to pass a zip for 61 | downloading. Follow the [Downloadify demo](http://pixelgraphics.us/downloadify/test.html) 62 | with the following changes: 63 | 64 | ```js 65 | zip = new JSZip(); 66 | zip.file("Hello.", "hello.txt"); 67 | 68 | zip.generateAsync({type:"base64"}).then(function (base64) { 69 | Downloadify.create('downloadify',{ 70 | ... 71 | data: function(){ 72 | return base64; 73 | }, 74 | ... 75 | dataType: 'base64' 76 | }); 77 | }); 78 | ``` 79 | 80 | 83 | 84 | #### Deprecated google gears 85 | 86 | [Franz Buchinger](http://www.picurl.org/blog/author/franz/) has written a 87 | brilliant tutorial on [using JSZip with Google Gears](http://www.picurl.org/blog/2009/11/22/creating-zip-archives-with-gears) 88 | ([part 2](http://www.picurl.org/blog/2009/11/29/gearszipper-part2-adding-support-for-real-files-and-canvas-elements/)). 89 | If you want to let your Gears users download several files at once I really 90 | recommend having a look at some of his [examples](http://picurl.org/gears/zipper/). 91 | 92 | 93 | 94 | ### In nodejs 95 | 96 | JSZip can generate Buffers so you can do the following : 97 | 98 | ```js 99 | var fs = require("fs"); 100 | var JSZip = require("jszip"); 101 | 102 | var zip = new JSZip(); 103 | // zip.file("file", content); 104 | // ... and other manipulations 105 | 106 | zip 107 | .generateNodeStream({type:'nodebuffer',streamFiles:true}) 108 | .pipe(fs.createWriteStream('out.zip')) 109 | .on('finish', function () { 110 | // JSZip generates a readable stream with a "end" event, 111 | // but is piped here in a writable stream which emits a "finish" event. 112 | console.log("out.zip written."); 113 | }); 114 | ``` 115 | 116 | 117 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/limitations.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Limitations of JSZip" 3 | layout: default 4 | section: limitations 5 | fullpage: true 6 | --- 7 | 8 | ### Not supported features 9 | 10 | Not all features of zip files are supported. Classic zip files will work 11 | but encrypted zip, multi-volume, etc are not supported and the loadAsync() 12 | method will return a failed promise. 13 | 14 | 15 | ### ZIP64 and 32bit integers 16 | 17 | ZIP64 files can be loaded, but only if the zip file is not "too big". ZIP64 uses 64bits integers 18 | but JavaScript represents all numbers as 19 | [64-bit double precision IEEE 754 floating point numbers](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf) 20 | (see section 8.5). So, we have 53bits for integers and 21 | [bitwise operations treat everything as 32bits](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators). 22 | So if all the 64bits integers can fit into 32 bits integers, everything will be 23 | fine. If it's not the case, you will have other problems anyway (see next 24 | limitation). 25 | 26 | ### Performance issues 27 | 28 | An other limitation comes from the browser (and the machine running the 29 | browser). A compressed zip file of 10MB is easily opened by firefox / chrome 30 | / opera / IE10+ but will crash older IE. Also keep in mind that strings in 31 | javascript are encoded in UTF-16 : a 10MB ascii text file will take 20MB of 32 | memory. 33 | 34 | The 35 | [`async` method]({{site.baseurl}}/documentation/api_zipobject/async.html) and the 36 | [`generateAsync` method]({{site.baseurl}}/documentation/api_jszip/generate_async.html) 37 | hold the full result in memory but doesn't freeze the browser. If the result 38 | is too big, and if you can't use the 39 | [`nodeStream` method]({{site.baseurl}}/documentation/api_zipobject/node_stream.html) or the 40 | [`generateNodeStream` method]({{site.baseurl}}/documentation/api_jszip/generate_node_stream.html) 41 | you need to use the underlying 42 | [`StreamHelper`]({{site.baseurl}}/documentation/api_streamhelper.html) to 43 | handle the result chunk by chunk and `pause()`/`resume()` to handle the 44 | backpressure. 45 | 46 | If you're having performance issues, please consider the following : 47 | 48 | * Don't use IE <= 9. Everything is better with typed arrays. 49 | * Use typed arrays (Uint8Array, ArrayBuffer, etc) if possible : 50 | * If you generate a zip file, you should use `type:"uint8array"` 51 | (or blob, arraybuffer, nodebuffer). 52 | * If you load the file from an ajax call, ask your XHR an ArrayBuffer. 53 | Loading a string is asking for troubles. 54 | 55 | Note about compression : 56 | When reading a file, JSZip will store the content without decompressing it. 57 | When generating a compressed file, JSZip will reuse if possible the compressed 58 | content : 59 | 60 | * If you read a zip file compressed with DEFLATE and call `generate` with the 61 | DEFLATE compression, JSZip won't call the compression algorithms (same with 62 | STORE everywhere.) 63 | * If you read a zip file compressed with DEFLATE and call `generate` with the 64 | STORE compression, JSZip will have to decompress everything. 65 | 66 | On IE <=9, typed arrays are not supported and the compression algorithm 67 | will fallback on arrays. In that case, JSZip needs to convert the binary string 68 | into an array, DEFLATE it and convert the result into a binary string. 69 | You don't want that to happen. 70 | 71 | ### The output zip will differ from the input zip 72 | 73 | Reading and generating a zip file won't give you back the same file. 74 | Some data are discarded (file metadata) and other are added (subfolders). 75 | 76 | ### Encodings support 77 | 78 | JSZip only supports UTF-8 natively. A zip file doesn't contain the name of the 79 | encoding used, you need to know it before doing anything. 80 | 81 | #### File name 82 | 83 | If the name of a file inside the zip is encoded with UTF-8 then JSZip can 84 | detect it (Language encoding flag, Unicode Path Extra Field). If not, JSZip 85 | can't detect the encoding used and will generate [Mojibake](https://en.wikipedia.org/wiki/Mojibake). 86 | You can use the [encodeFileName]({{site.baseurl}}/documentation/api_jszip/generate.html) 87 | option and the [decodeFileName]({{site.baseurl}}/documentation/api_jszip/load.html) 88 | option to encode/decode using a custom encoding. 89 | 90 | #### File content 91 | 92 | The `async("string")` method uses UTF-8 to decode the content. If you have a text in 93 | a different encoding, you can get the bytes array with `async("uint8array")` and 94 | decode it with a lib (iconv, iconv-lite, etc) on your side. 95 | To save a text using a non-UTF-8 encoding, do the same : encode it into a 96 | Uint8Array before adding it to JSZip. 97 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/documentation/upgrade_guide.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Upgrade Guide 3 | layout: default 4 | section: main 5 | --- 6 | 7 | ### From 2.x to 3.0.0 8 | 9 | * Deprecated objects/methods has been removed: 10 | * `options.base64` in `generate()` (the base64 type is still valid) 11 | * `options.base64`, `options.binary`, `options.dir`, `options.date` 12 | on `ZipObject` (see the [2.3 upgrade section](#from-222-to-230)) 13 | * `JSZip.utils` 14 | * `JSZip.prototype.crc32`, `JSZip.prototype.utf8encode`, `JSZip.prototype.utf8decode` 15 | * `JSZip.base64` (you can get the content of a file directly as a base64 string) 16 | * `JSZip.compressions` has been removed. 17 | * On `ZipObject`, the synchronous getters has been replaced by `async()` and 18 | `nodeStream()`. 19 | * The `generate()` method has been replaced by `generateAsync()` and 20 | `generateNodeStream()`. 21 | * The `type` option in `generate()` is now mandatory. 22 | * The "text" type has been replaced by the "string" type, a binary string is 23 | named "binarystring". 24 | * The `load()` method and the constructor with data (`new JSZip(data)`) have 25 | been replaced by `loadAsync()`. 26 | * When adding a file, the option `createFolders` now defaults to `true`. If 27 | you don't want to create sub folders, set it to false. 28 | * `zip.generateAsync()` and `zip.generateNodeStream()` now depend on the 29 | current folder level. 30 | 31 | ```js 32 | // 2.x 33 | zip.file("test.txt").asText(); 34 | // 3.x 35 | zip.file("test.txt").async("string") 36 | .then(function (content) { 37 | // use content 38 | }); 39 | 40 | 41 | // 2.x 42 | zip.generate(); 43 | // 3.x 44 | zip.generateAsync({type:"uint8array"}) 45 | .then(function (content) { 46 | // use content 47 | }); 48 | 49 | // 2.x 50 | new JSZip(data); 51 | zip.load(data); 52 | // zip.file(...) 53 | // 3.x 54 | JSZip.loadAsync(data).then(zip) {...}; 55 | zip.loadAsync(data).then(zip) {...}; 56 | // here, zip won't have (yet) the updated content 57 | 58 | // 2.x 59 | var data = zip.file("img.jpg").asBinary(); 60 | var dataURI = "data:image/jpeg;base64," + JSZip.base64.encode(data); 61 | // 3.x 62 | zip.file("img.jpg").async("base64") 63 | .then(function (data64) { 64 | var dataURI = "data:image/jpeg;base64," + data64; 65 | }); 66 | ``` 67 | 68 | `async` and `loadAsync` use (a polyfill of) promises, you can find 69 | the documentation [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) 70 | and a tutorial [here](http://www.html5rocks.com/en/tutorials/es6/promises/). 71 | 72 | It is worth noting that: 73 | 74 | ```js 75 | /* 76 | * JSZip accepts these promise as input 77 | */ 78 | 79 | // replace a content with JSZip v2 80 | var content = zip.file("my_file").asText(); 81 | content = content.replace(/apples/, 'oranges'); 82 | zip.file("my_file", content); 83 | 84 | // replace a content with JSZip v3 85 | var contentPromise = zip.file("my_file").async("text").then(function (content) { 86 | return content.replace(/apples/, 'oranges'); 87 | }); 88 | zip.file("my_file", contentPromise); 89 | 90 | 91 | /* 92 | * Promises are chainable 93 | */ 94 | 95 | // read, update, generate a zip file with JSZip v2 96 | var zip = new JSZip(content); 97 | zip.file("new_file", "new_content"); 98 | var blob = zip.generate({type: "blob"}); 99 | saveAs(blob, "result.zip"); 100 | 101 | // read, update, generate a zip file with JSZip v3 102 | JSZip.loadAsync(content) 103 | .then(function (zip) { 104 | zip.file("new_file", "new_content"); 105 | // if you return the zip object, it will be available in the next "then" 106 | return zip; 107 | .then(function (zip) { 108 | // if you return a promise of a blob, promises will "merge": the current 109 | // promise will wait for the other and the next "then" will get the 110 | // blob 111 | return zip.generateAsync({type: "blob"}); 112 | .then(function (blob) { 113 | saveAs(blob, "result.zip"); 114 | }); 115 | ``` 116 | 117 | ### From 2.2.2 to 2.3.0 118 | 119 | * On `ZipObject#options`, the attributes `date` and `dir` have been 120 | deprecated and are now on `ZipObject`. 121 | * On `ZipObject#options`, the attributes `base64` and `binary` have been 122 | deprecated. 123 | * `JSZip.base64`, `JSZip.prototype.crc32`, `JSZip.prototype.utf8decode`, 124 | `JSZip.prototype.utf8encode` and `JSZip.utils` have been deprecated. 125 | 126 | ```js 127 | // deprecated 128 | zip.file("test.txt").options.date 129 | zip.file("test.txt").options.dir 130 | // new API 131 | zip.file("test.txt").date 132 | zip.file("test.txt").dir 133 | ``` 134 | 135 | 136 | ### From 2.0.0 to 2.1.0 137 | 138 | * The packaging changed : instead of loading jszip.js, jszip-load.js, 139 | jszip-inflate.js, jszip-deflate.js, just include dist/jszip.js or 140 | dist/jszip.min.js. 141 | For AMD loader users : JSZip now registers itself. You just have to put the 142 | file at the right place or configure your loader. 143 | 144 | 145 | ### From 1.x to 2.x 146 | 147 | * `JSZipBase64` has been renamed to `JSZip.base64`. 148 | * The `data` attribute doesn't exist anymore : 149 | use the getters `asText()`, `asBinary()`, etc 150 | * The compression/decompression methods now give their input type with the 151 | `compressInputType` and `uncompressInputType` attributes. 152 | 153 | Example for the data attribute : 154 | 155 | ```js 156 | // before 157 | zip.file("test.txt").data; 158 | zip.files["test.txt"].data; 159 | zip.file("image.png").data; 160 | zip.files["image.png"].data; 161 | 162 | // after 163 | zip.file("test.txt").asText(); 164 | zip.files["test.txt"].asText(); 165 | zip.file("image.png").asBinary(); 166 | zip.files["image.png"].asBinary(); 167 | ``` 168 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | title: JSZip 3 | layout: default 4 | section: main 5 | --- 6 | 7 |
    8 |
    9 | 10 | JSZip is a javascript library for creating, reading and editing .zip files, with a 11 | lovely and simple API. 12 | 13 |
    14 |
    15 |

    16 | Current version : v3.1.5 17 |

    18 |

    19 | License : JSZip is dual-licensed. You may use it under the 20 | MIT license or the GPLv3 license. See 21 | LICENSE.markdown. 22 |

    23 |
    24 | 25 |
    26 |
    27 | 28 |

    Example

    29 | 30 | 57 | 67 | 68 | 69 | 73 |
    74 |
    75 | 76 |

    Installation

    77 | 78 |

    79 | With npm : npm install jszip 80 |

    81 |

    82 | With bower : bower install Stuk/jszip 83 |

    84 |

    85 | With component : component install Stuk/jszip 86 |

    87 |

    88 | Manually : download JSZip 89 | and include the file dist/jszip.js or dist/jszip.min.js 90 |

    91 |
    92 |

    93 | Installed ? Great ! You can now check our 94 | guides and examples ! 95 |

    96 |
    97 |
    98 | 99 |

    Support

    100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 |
    OperaFirefoxSafariChromeInternet ExplorerNode.js
    YesYesYesYesYesYes
    Tested with the latest versionTested with 3.0 / 3.6 / latest versionTested with the latest versionTested with the latest versionTested with IE 6 / 7 / 8 / 9 / 10Tested with node.js 0.10 / latest version
    127 | 128 |

    Getting help

    129 | 130 |

    131 | Having trouble ? We'd like to help ! 132 |

    133 |
      134 |
    • 135 | Try the FAQ, it has 136 | answers to common questions. 137 |
    • 138 |
    • 139 | If you're looking for informations about a specific method, try the 140 | documentation. 141 |
    • 142 |
    • 143 | Check the 144 | examples. 145 |
    • 146 |
    • 147 | Report bugs in our 148 | Bug tracker. 149 |
    • 150 |
    151 | 152 |

    Test status

    153 | 154 |
    155 |
    Travis build :
    156 |
    157 | 158 | 159 | 160 |
    161 |
    Saucelabs build :
    162 |
    163 | 164 | 165 | 166 |
    167 |
    Live tests :
    168 |
    169 | See for yourself ! 170 |
    171 |
    172 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/base64.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var utils = require('./utils'); 3 | var support = require('./support'); 4 | // private property 5 | var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; 6 | 7 | 8 | // public method for encoding 9 | exports.encode = function(input) { 10 | var output = []; 11 | var chr1, chr2, chr3, enc1, enc2, enc3, enc4; 12 | var i = 0, len = input.length, remainingBytes = len; 13 | 14 | var isArray = utils.getTypeOf(input) !== "string"; 15 | while (i < input.length) { 16 | remainingBytes = len - i; 17 | 18 | if (!isArray) { 19 | chr1 = input.charCodeAt(i++); 20 | chr2 = i < len ? input.charCodeAt(i++) : 0; 21 | chr3 = i < len ? input.charCodeAt(i++) : 0; 22 | } else { 23 | chr1 = input[i++]; 24 | chr2 = i < len ? input[i++] : 0; 25 | chr3 = i < len ? input[i++] : 0; 26 | } 27 | 28 | enc1 = chr1 >> 2; 29 | enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); 30 | enc3 = remainingBytes > 1 ? (((chr2 & 15) << 2) | (chr3 >> 6)) : 64; 31 | enc4 = remainingBytes > 2 ? (chr3 & 63) : 64; 32 | 33 | output.push(_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4)); 34 | 35 | } 36 | 37 | return output.join(""); 38 | }; 39 | 40 | // public method for decoding 41 | exports.decode = function(input) { 42 | var chr1, chr2, chr3; 43 | var enc1, enc2, enc3, enc4; 44 | var i = 0, resultIndex = 0; 45 | 46 | var dataUrlPrefix = "data:"; 47 | 48 | if (input.substr(0, dataUrlPrefix.length) === dataUrlPrefix) { 49 | // This is a common error: people give a data url 50 | // (data:image/png;base64,iVBOR...) with a {base64: true} and 51 | // wonders why things don't work. 52 | // We can detect that the string input looks like a data url but we 53 | // *can't* be sure it is one: removing everything up to the comma would 54 | // be too dangerous. 55 | throw new Error("Invalid base64 input, it looks like a data url."); 56 | } 57 | 58 | input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); 59 | 60 | var totalLength = input.length * 3 / 4; 61 | if(input.charAt(input.length - 1) === _keyStr.charAt(64)) { 62 | totalLength--; 63 | } 64 | if(input.charAt(input.length - 2) === _keyStr.charAt(64)) { 65 | totalLength--; 66 | } 67 | if (totalLength % 1 !== 0) { 68 | // totalLength is not an integer, the length does not match a valid 69 | // base64 content. That can happen if: 70 | // - the input is not a base64 content 71 | // - the input is *almost* a base64 content, with a extra chars at the 72 | // beginning or at the end 73 | // - the input uses a base64 variant (base64url for example) 74 | throw new Error("Invalid base64 input, bad content length."); 75 | } 76 | var output; 77 | if (support.uint8array) { 78 | output = new Uint8Array(totalLength|0); 79 | } else { 80 | output = new Array(totalLength|0); 81 | } 82 | 83 | while (i < input.length) { 84 | 85 | enc1 = _keyStr.indexOf(input.charAt(i++)); 86 | enc2 = _keyStr.indexOf(input.charAt(i++)); 87 | enc3 = _keyStr.indexOf(input.charAt(i++)); 88 | enc4 = _keyStr.indexOf(input.charAt(i++)); 89 | 90 | chr1 = (enc1 << 2) | (enc2 >> 4); 91 | chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); 92 | chr3 = ((enc3 & 3) << 6) | enc4; 93 | 94 | output[resultIndex++] = chr1; 95 | 96 | if (enc3 !== 64) { 97 | output[resultIndex++] = chr2; 98 | } 99 | if (enc4 !== 64) { 100 | output[resultIndex++] = chr3; 101 | } 102 | 103 | } 104 | 105 | return output; 106 | }; 107 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/compressedObject.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var external = require("./external"); 4 | var DataWorker = require('./stream/DataWorker'); 5 | var DataLengthProbe = require('./stream/DataLengthProbe'); 6 | var Crc32Probe = require('./stream/Crc32Probe'); 7 | var DataLengthProbe = require('./stream/DataLengthProbe'); 8 | 9 | /** 10 | * Represent a compressed object, with everything needed to decompress it. 11 | * @constructor 12 | * @param {number} compressedSize the size of the data compressed. 13 | * @param {number} uncompressedSize the size of the data after decompression. 14 | * @param {number} crc32 the crc32 of the decompressed file. 15 | * @param {object} compression the type of compression, see lib/compressions.js. 16 | * @param {String|ArrayBuffer|Uint8Array|Buffer} data the compressed data. 17 | */ 18 | function CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) { 19 | this.compressedSize = compressedSize; 20 | this.uncompressedSize = uncompressedSize; 21 | this.crc32 = crc32; 22 | this.compression = compression; 23 | this.compressedContent = data; 24 | } 25 | 26 | CompressedObject.prototype = { 27 | /** 28 | * Create a worker to get the uncompressed content. 29 | * @return {GenericWorker} the worker. 30 | */ 31 | getContentWorker : function () { 32 | var worker = new DataWorker(external.Promise.resolve(this.compressedContent)) 33 | .pipe(this.compression.uncompressWorker()) 34 | .pipe(new DataLengthProbe("data_length")); 35 | 36 | var that = this; 37 | worker.on("end", function () { 38 | if(this.streamInfo['data_length'] !== that.uncompressedSize) { 39 | throw new Error("Bug : uncompressed data size mismatch"); 40 | } 41 | }); 42 | return worker; 43 | }, 44 | /** 45 | * Create a worker to get the compressed content. 46 | * @return {GenericWorker} the worker. 47 | */ 48 | getCompressedWorker : function () { 49 | return new DataWorker(external.Promise.resolve(this.compressedContent)) 50 | .withStreamInfo("compressedSize", this.compressedSize) 51 | .withStreamInfo("uncompressedSize", this.uncompressedSize) 52 | .withStreamInfo("crc32", this.crc32) 53 | .withStreamInfo("compression", this.compression) 54 | ; 55 | } 56 | }; 57 | 58 | /** 59 | * Chain the given worker with other workers to compress the content with the 60 | * given compresion. 61 | * @param {GenericWorker} uncompressedWorker the worker to pipe. 62 | * @param {Object} compression the compression object. 63 | * @param {Object} compressionOptions the options to use when compressing. 64 | * @return {GenericWorker} the new worker compressing the content. 65 | */ 66 | CompressedObject.createWorkerFrom = function (uncompressedWorker, compression, compressionOptions) { 67 | return uncompressedWorker 68 | .pipe(new Crc32Probe()) 69 | .pipe(new DataLengthProbe("uncompressedSize")) 70 | .pipe(compression.compressWorker(compressionOptions)) 71 | .pipe(new DataLengthProbe("compressedSize")) 72 | .withStreamInfo("compression", compression); 73 | }; 74 | 75 | module.exports = CompressedObject; 76 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/compressions.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var GenericWorker = require("./stream/GenericWorker"); 4 | 5 | exports.STORE = { 6 | magic: "\x00\x00", 7 | compressWorker : function (compressionOptions) { 8 | return new GenericWorker("STORE compression"); 9 | }, 10 | uncompressWorker : function () { 11 | return new GenericWorker("STORE decompression"); 12 | } 13 | }; 14 | exports.DEFLATE = require('./flate'); 15 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/crc32.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('./utils'); 4 | 5 | /** 6 | * The following functions come from pako, from pako/lib/zlib/crc32.js 7 | * released under the MIT license, see pako https://github.com/nodeca/pako/ 8 | */ 9 | 10 | // Use ordinary array, since untyped makes no boost here 11 | function makeTable() { 12 | var c, table = []; 13 | 14 | for(var n =0; n < 256; n++){ 15 | c = n; 16 | for(var k =0; k < 8; k++){ 17 | c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); 18 | } 19 | table[n] = c; 20 | } 21 | 22 | return table; 23 | } 24 | 25 | // Create table on load. Just 255 signed longs. Not a problem. 26 | var crcTable = makeTable(); 27 | 28 | 29 | function crc32(crc, buf, len, pos) { 30 | var t = crcTable, end = pos + len; 31 | 32 | crc = crc ^ (-1); 33 | 34 | for (var i = pos; i < end; i++ ) { 35 | crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; 36 | } 37 | 38 | return (crc ^ (-1)); // >>> 0; 39 | } 40 | 41 | // That's all for the pako functions. 42 | 43 | /** 44 | * Compute the crc32 of a string. 45 | * This is almost the same as the function crc32, but for strings. Using the 46 | * same function for the two use cases leads to horrible performances. 47 | * @param {Number} crc the starting value of the crc. 48 | * @param {String} str the string to use. 49 | * @param {Number} len the length of the string. 50 | * @param {Number} pos the starting position for the crc32 computation. 51 | * @return {Number} the computed crc32. 52 | */ 53 | function crc32str(crc, str, len, pos) { 54 | var t = crcTable, end = pos + len; 55 | 56 | crc = crc ^ (-1); 57 | 58 | for (var i = pos; i < end; i++ ) { 59 | crc = (crc >>> 8) ^ t[(crc ^ str.charCodeAt(i)) & 0xFF]; 60 | } 61 | 62 | return (crc ^ (-1)); // >>> 0; 63 | } 64 | 65 | module.exports = function crc32wrapper(input, crc) { 66 | if (typeof input === "undefined" || !input.length) { 67 | return 0; 68 | } 69 | 70 | var isArray = utils.getTypeOf(input) !== "string"; 71 | 72 | if(isArray) { 73 | return crc32(crc|0, input, input.length, 0); 74 | } else { 75 | return crc32str(crc|0, input, input.length, 0); 76 | } 77 | }; 78 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/defaults.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | exports.base64 = false; 3 | exports.binary = false; 4 | exports.dir = false; 5 | exports.createFolders = true; 6 | exports.date = null; 7 | exports.compression = null; 8 | exports.compressionOptions = null; 9 | exports.comment = null; 10 | exports.unixPermissions = null; 11 | exports.dosPermissions = null; 12 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/external.js: -------------------------------------------------------------------------------- 1 | /* global Promise */ 2 | 'use strict'; 3 | 4 | // load the global object first: 5 | // - it should be better integrated in the system (unhandledRejection in node) 6 | // - the environment may have a custom Promise implementation (see zone.js) 7 | var ES6Promise = null; 8 | if (typeof Promise !== "undefined") { 9 | ES6Promise = Promise; 10 | } else { 11 | ES6Promise = require("lie"); 12 | } 13 | 14 | /** 15 | * Let the user use/change some implementations. 16 | */ 17 | module.exports = { 18 | Promise: ES6Promise 19 | }; 20 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/flate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined'); 3 | 4 | var pako = require("pako"); 5 | var utils = require("./utils"); 6 | var GenericWorker = require("./stream/GenericWorker"); 7 | 8 | var ARRAY_TYPE = USE_TYPEDARRAY ? "uint8array" : "array"; 9 | 10 | exports.magic = "\x08\x00"; 11 | 12 | /** 13 | * Create a worker that uses pako to inflate/deflate. 14 | * @constructor 15 | * @param {String} action the name of the pako function to call : either "Deflate" or "Inflate". 16 | * @param {Object} options the options to use when (de)compressing. 17 | */ 18 | function FlateWorker(action, options) { 19 | GenericWorker.call(this, "FlateWorker/" + action); 20 | 21 | this._pako = null; 22 | this._pakoAction = action; 23 | this._pakoOptions = options; 24 | // the `meta` object from the last chunk received 25 | // this allow this worker to pass around metadata 26 | this.meta = {}; 27 | } 28 | 29 | utils.inherits(FlateWorker, GenericWorker); 30 | 31 | /** 32 | * @see GenericWorker.processChunk 33 | */ 34 | FlateWorker.prototype.processChunk = function (chunk) { 35 | this.meta = chunk.meta; 36 | if (this._pako === null) { 37 | this._createPako(); 38 | } 39 | this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), false); 40 | }; 41 | 42 | /** 43 | * @see GenericWorker.flush 44 | */ 45 | FlateWorker.prototype.flush = function () { 46 | GenericWorker.prototype.flush.call(this); 47 | if (this._pako === null) { 48 | this._createPako(); 49 | } 50 | this._pako.push([], true); 51 | }; 52 | /** 53 | * @see GenericWorker.cleanUp 54 | */ 55 | FlateWorker.prototype.cleanUp = function () { 56 | GenericWorker.prototype.cleanUp.call(this); 57 | this._pako = null; 58 | }; 59 | 60 | /** 61 | * Create the _pako object. 62 | * TODO: lazy-loading this object isn't the best solution but it's the 63 | * quickest. The best solution is to lazy-load the worker list. See also the 64 | * issue #446. 65 | */ 66 | FlateWorker.prototype._createPako = function () { 67 | this._pako = new pako[this._pakoAction]({ 68 | raw: true, 69 | level: this._pakoOptions.level || -1 // default compression 70 | }); 71 | var self = this; 72 | this._pako.onData = function(data) { 73 | self.push({ 74 | data : data, 75 | meta : self.meta 76 | }); 77 | }; 78 | }; 79 | 80 | exports.compressWorker = function (compressionOptions) { 81 | return new FlateWorker("Deflate", compressionOptions); 82 | }; 83 | exports.uncompressWorker = function () { 84 | return new FlateWorker("Inflate", {}); 85 | }; 86 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/generate/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var compressions = require('../compressions'); 4 | var ZipFileWorker = require('./ZipFileWorker'); 5 | 6 | /** 7 | * Find the compression to use. 8 | * @param {String} fileCompression the compression defined at the file level, if any. 9 | * @param {String} zipCompression the compression defined at the load() level. 10 | * @return {Object} the compression object to use. 11 | */ 12 | var getCompression = function (fileCompression, zipCompression) { 13 | 14 | var compressionName = fileCompression || zipCompression; 15 | var compression = compressions[compressionName]; 16 | if (!compression) { 17 | throw new Error(compressionName + " is not a valid compression method !"); 18 | } 19 | return compression; 20 | }; 21 | 22 | /** 23 | * Create a worker to generate a zip file. 24 | * @param {JSZip} zip the JSZip instance at the right root level. 25 | * @param {Object} options to generate the zip file. 26 | * @param {String} comment the comment to use. 27 | */ 28 | exports.generateWorker = function (zip, options, comment) { 29 | 30 | var zipFileWorker = new ZipFileWorker(options.streamFiles, comment, options.platform, options.encodeFileName); 31 | var entriesCount = 0; 32 | try { 33 | 34 | zip.forEach(function (relativePath, file) { 35 | entriesCount++; 36 | var compression = getCompression(file.options.compression, options.compression); 37 | var compressionOptions = file.options.compressionOptions || options.compressionOptions || {}; 38 | var dir = file.dir, date = file.date; 39 | 40 | file._compressWorker(compression, compressionOptions) 41 | .withStreamInfo("file", { 42 | name : relativePath, 43 | dir : dir, 44 | date : date, 45 | comment : file.comment || "", 46 | unixPermissions : file.unixPermissions, 47 | dosPermissions : file.dosPermissions 48 | }) 49 | .pipe(zipFileWorker); 50 | }); 51 | zipFileWorker.entriesCount = entriesCount; 52 | } catch (e) { 53 | zipFileWorker.error(e); 54 | } 55 | 56 | return zipFileWorker; 57 | }; 58 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Representation a of zip file in js 5 | * @constructor 6 | */ 7 | function JSZip() { 8 | // if this constructor is used without `new`, it adds `new` before itself: 9 | if(!(this instanceof JSZip)) { 10 | return new JSZip(); 11 | } 12 | 13 | if(arguments.length) { 14 | throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide."); 15 | } 16 | 17 | // object containing the files : 18 | // { 19 | // "folder/" : {...}, 20 | // "folder/data.txt" : {...} 21 | // } 22 | this.files = {}; 23 | 24 | this.comment = null; 25 | 26 | // Where we are in the hierarchy 27 | this.root = ""; 28 | this.clone = function() { 29 | var newObj = new JSZip(); 30 | for (var i in this) { 31 | if (typeof this[i] !== "function") { 32 | newObj[i] = this[i]; 33 | } 34 | } 35 | return newObj; 36 | }; 37 | } 38 | JSZip.prototype = require('./object'); 39 | JSZip.prototype.loadAsync = require('./load'); 40 | JSZip.support = require('./support'); 41 | JSZip.defaults = require('./defaults'); 42 | 43 | // TODO find a better way to handle this version, 44 | // a require('package.json').version doesn't work with webpack, see #327 45 | JSZip.version = "3.1.5"; 46 | 47 | JSZip.loadAsync = function (content, options) { 48 | return new JSZip().loadAsync(content, options); 49 | }; 50 | 51 | JSZip.external = require("./external"); 52 | module.exports = JSZip; 53 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/license_header.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | JSZip v__VERSION__ - A JavaScript class for generating and reading zip files 4 | 5 | 6 | (c) 2009-2016 Stuart Knightley 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. 8 | 9 | JSZip uses the library pako released under the MIT license : 10 | https://github.com/nodeca/pako/blob/master/LICENSE 11 | */ 12 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/load.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var utils = require('./utils'); 3 | var external = require("./external"); 4 | var utf8 = require('./utf8'); 5 | var utils = require('./utils'); 6 | var ZipEntries = require('./zipEntries'); 7 | var Crc32Probe = require('./stream/Crc32Probe'); 8 | var nodejsUtils = require("./nodejsUtils"); 9 | 10 | /** 11 | * Check the CRC32 of an entry. 12 | * @param {ZipEntry} zipEntry the zip entry to check. 13 | * @return {Promise} the result. 14 | */ 15 | function checkEntryCRC32(zipEntry) { 16 | return new external.Promise(function (resolve, reject) { 17 | var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe()); 18 | worker.on("error", function (e) { 19 | reject(e); 20 | }) 21 | .on("end", function () { 22 | if (worker.streamInfo.crc32 !== zipEntry.decompressed.crc32) { 23 | reject(new Error("Corrupted zip : CRC32 mismatch")); 24 | } else { 25 | resolve(); 26 | } 27 | }) 28 | .resume(); 29 | }); 30 | } 31 | 32 | module.exports = function(data, options) { 33 | var zip = this; 34 | options = utils.extend(options || {}, { 35 | base64: false, 36 | checkCRC32: false, 37 | optimizedBinaryString: false, 38 | createFolders: false, 39 | decodeFileName: utf8.utf8decode 40 | }); 41 | 42 | if (nodejsUtils.isNode && nodejsUtils.isStream(data)) { 43 | return external.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")); 44 | } 45 | 46 | return utils.prepareContent("the loaded zip file", data, true, options.optimizedBinaryString, options.base64) 47 | .then(function(data) { 48 | var zipEntries = new ZipEntries(options); 49 | zipEntries.load(data); 50 | return zipEntries; 51 | }).then(function checkCRC32(zipEntries) { 52 | var promises = [external.Promise.resolve(zipEntries)]; 53 | var files = zipEntries.files; 54 | if (options.checkCRC32) { 55 | for (var i = 0; i < files.length; i++) { 56 | promises.push(checkEntryCRC32(files[i])); 57 | } 58 | } 59 | return external.Promise.all(promises); 60 | }).then(function addFiles(results) { 61 | var zipEntries = results.shift(); 62 | var files = zipEntries.files; 63 | for (var i = 0; i < files.length; i++) { 64 | var input = files[i]; 65 | zip.file(input.fileNameStr, input.decompressed, { 66 | binary: true, 67 | optimizedBinaryString: true, 68 | date: input.date, 69 | dir: input.dir, 70 | comment : input.fileCommentStr.length ? input.fileCommentStr : null, 71 | unixPermissions : input.unixPermissions, 72 | dosPermissions : input.dosPermissions, 73 | createFolders: options.createFolders 74 | }); 75 | } 76 | if (zipEntries.zipComment.length) { 77 | zip.comment = zipEntries.zipComment; 78 | } 79 | 80 | return zip; 81 | }); 82 | }; 83 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/nodejs/NodejsStreamInputAdapter.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var utils = require('../utils'); 4 | var GenericWorker = require('../stream/GenericWorker'); 5 | 6 | /** 7 | * A worker that use a nodejs stream as source. 8 | * @constructor 9 | * @param {String} filename the name of the file entry for this stream. 10 | * @param {Readable} stream the nodejs stream. 11 | */ 12 | function NodejsStreamInputAdapter(filename, stream) { 13 | GenericWorker.call(this, "Nodejs stream input adapter for " + filename); 14 | this._upstreamEnded = false; 15 | this._bindStream(stream); 16 | } 17 | 18 | utils.inherits(NodejsStreamInputAdapter, GenericWorker); 19 | 20 | /** 21 | * Prepare the stream and bind the callbacks on it. 22 | * Do this ASAP on node 0.10 ! A lazy binding doesn't always work. 23 | * @param {Stream} stream the nodejs stream to use. 24 | */ 25 | NodejsStreamInputAdapter.prototype._bindStream = function (stream) { 26 | var self = this; 27 | this._stream = stream; 28 | stream.pause(); 29 | stream 30 | .on("data", function (chunk) { 31 | self.push({ 32 | data: chunk, 33 | meta : { 34 | percent : 0 35 | } 36 | }); 37 | }) 38 | .on("error", function (e) { 39 | if(self.isPaused) { 40 | this.generatedError = e; 41 | } else { 42 | self.error(e); 43 | } 44 | }) 45 | .on("end", function () { 46 | if(self.isPaused) { 47 | self._upstreamEnded = true; 48 | } else { 49 | self.end(); 50 | } 51 | }); 52 | }; 53 | NodejsStreamInputAdapter.prototype.pause = function () { 54 | if(!GenericWorker.prototype.pause.call(this)) { 55 | return false; 56 | } 57 | this._stream.pause(); 58 | return true; 59 | }; 60 | NodejsStreamInputAdapter.prototype.resume = function () { 61 | if(!GenericWorker.prototype.resume.call(this)) { 62 | return false; 63 | } 64 | 65 | if(this._upstreamEnded) { 66 | this.end(); 67 | } else { 68 | this._stream.resume(); 69 | } 70 | 71 | return true; 72 | }; 73 | 74 | module.exports = NodejsStreamInputAdapter; 75 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/nodejs/NodejsStreamOutputAdapter.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Readable = require('readable-stream').Readable; 4 | 5 | var utils = require('../utils'); 6 | utils.inherits(NodejsStreamOutputAdapter, Readable); 7 | 8 | /** 9 | * A nodejs stream using a worker as source. 10 | * @see the SourceWrapper in http://nodejs.org/api/stream.html 11 | * @constructor 12 | * @param {StreamHelper} helper the helper wrapping the worker 13 | * @param {Object} options the nodejs stream options 14 | * @param {Function} updateCb the update callback. 15 | */ 16 | function NodejsStreamOutputAdapter(helper, options, updateCb) { 17 | Readable.call(this, options); 18 | this._helper = helper; 19 | 20 | var self = this; 21 | helper.on("data", function (data, meta) { 22 | if (!self.push(data)) { 23 | self._helper.pause(); 24 | } 25 | if(updateCb) { 26 | updateCb(meta); 27 | } 28 | }) 29 | .on("error", function(e) { 30 | self.emit('error', e); 31 | }) 32 | .on("end", function () { 33 | self.push(null); 34 | }); 35 | } 36 | 37 | 38 | NodejsStreamOutputAdapter.prototype._read = function() { 39 | this._helper.resume(); 40 | }; 41 | 42 | module.exports = NodejsStreamOutputAdapter; 43 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/nodejsUtils.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | /** 5 | * True if this is running in Nodejs, will be undefined in a browser. 6 | * In a browser, browserify won't include this file and the whole module 7 | * will be resolved an empty object. 8 | */ 9 | isNode : typeof Buffer !== "undefined", 10 | /** 11 | * Create a new nodejs Buffer from an existing content. 12 | * @param {Object} data the data to pass to the constructor. 13 | * @param {String} encoding the encoding to use. 14 | * @return {Buffer} a new Buffer. 15 | */ 16 | newBufferFrom: function(data, encoding) { 17 | // XXX We can't use `Buffer.from` which comes from `Uint8Array.from` 18 | // in nodejs v4 (< v.4.5). It's not the expected implementation (and 19 | // has a different signature). 20 | // see https://github.com/nodejs/node/issues/8053 21 | // A condition on nodejs' version won't solve the issue as we don't 22 | // control the Buffer polyfills that may or may not be used. 23 | return new Buffer(data, encoding); 24 | }, 25 | /** 26 | * Create a new nodejs Buffer with the specified size. 27 | * @param {Integer} size the size of the buffer. 28 | * @return {Buffer} a new Buffer. 29 | */ 30 | allocBuffer: function (size) { 31 | if (Buffer.alloc) { 32 | return Buffer.alloc(size); 33 | } else { 34 | return new Buffer(size); 35 | } 36 | }, 37 | /** 38 | * Find out if an object is a Buffer. 39 | * @param {Object} b the object to test. 40 | * @return {Boolean} true if the object is a Buffer, false otherwise. 41 | */ 42 | isBuffer : function(b){ 43 | return Buffer.isBuffer(b); 44 | }, 45 | 46 | isStream : function (obj) { 47 | return obj && 48 | typeof obj.on === "function" && 49 | typeof obj.pause === "function" && 50 | typeof obj.resume === "function"; 51 | } 52 | }; 53 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/readable-stream-browser.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is used by module bundlers (browserify/webpack/etc) when 3 | * including a stream implementation. We use "readable-stream" to get a 4 | * consistent behavior between nodejs versions but bundlers often have a shim 5 | * for "stream". Using this shim greatly improve the compatibility and greatly 6 | * reduce the final size of the bundle (only one stream implementation, not 7 | * two). 8 | */ 9 | module.exports = require("stream"); 10 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/reader/ArrayReader.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var DataReader = require('./DataReader'); 3 | var utils = require('../utils'); 4 | 5 | function ArrayReader(data) { 6 | DataReader.call(this, data); 7 | for(var i = 0; i < this.data.length; i++) { 8 | data[i] = data[i] & 0xFF; 9 | } 10 | } 11 | utils.inherits(ArrayReader, DataReader); 12 | /** 13 | * @see DataReader.byteAt 14 | */ 15 | ArrayReader.prototype.byteAt = function(i) { 16 | return this.data[this.zero + i]; 17 | }; 18 | /** 19 | * @see DataReader.lastIndexOfSignature 20 | */ 21 | ArrayReader.prototype.lastIndexOfSignature = function(sig) { 22 | var sig0 = sig.charCodeAt(0), 23 | sig1 = sig.charCodeAt(1), 24 | sig2 = sig.charCodeAt(2), 25 | sig3 = sig.charCodeAt(3); 26 | for (var i = this.length - 4; i >= 0; --i) { 27 | if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) { 28 | return i - this.zero; 29 | } 30 | } 31 | 32 | return -1; 33 | }; 34 | /** 35 | * @see DataReader.readAndCheckSignature 36 | */ 37 | ArrayReader.prototype.readAndCheckSignature = function (sig) { 38 | var sig0 = sig.charCodeAt(0), 39 | sig1 = sig.charCodeAt(1), 40 | sig2 = sig.charCodeAt(2), 41 | sig3 = sig.charCodeAt(3), 42 | data = this.readData(4); 43 | return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3]; 44 | }; 45 | /** 46 | * @see DataReader.readData 47 | */ 48 | ArrayReader.prototype.readData = function(size) { 49 | this.checkOffset(size); 50 | if(size === 0) { 51 | return []; 52 | } 53 | var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); 54 | this.index += size; 55 | return result; 56 | }; 57 | module.exports = ArrayReader; 58 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/reader/DataReader.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var utils = require('../utils'); 3 | 4 | function DataReader(data) { 5 | this.data = data; // type : see implementation 6 | this.length = data.length; 7 | this.index = 0; 8 | this.zero = 0; 9 | } 10 | DataReader.prototype = { 11 | /** 12 | * Check that the offset will not go too far. 13 | * @param {string} offset the additional offset to check. 14 | * @throws {Error} an Error if the offset is out of bounds. 15 | */ 16 | checkOffset: function(offset) { 17 | this.checkIndex(this.index + offset); 18 | }, 19 | /** 20 | * Check that the specified index will not be too far. 21 | * @param {string} newIndex the index to check. 22 | * @throws {Error} an Error if the index is out of bounds. 23 | */ 24 | checkIndex: function(newIndex) { 25 | if (this.length < this.zero + newIndex || newIndex < 0) { 26 | throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?"); 27 | } 28 | }, 29 | /** 30 | * Change the index. 31 | * @param {number} newIndex The new index. 32 | * @throws {Error} if the new index is out of the data. 33 | */ 34 | setIndex: function(newIndex) { 35 | this.checkIndex(newIndex); 36 | this.index = newIndex; 37 | }, 38 | /** 39 | * Skip the next n bytes. 40 | * @param {number} n the number of bytes to skip. 41 | * @throws {Error} if the new index is out of the data. 42 | */ 43 | skip: function(n) { 44 | this.setIndex(this.index + n); 45 | }, 46 | /** 47 | * Get the byte at the specified index. 48 | * @param {number} i the index to use. 49 | * @return {number} a byte. 50 | */ 51 | byteAt: function(i) { 52 | // see implementations 53 | }, 54 | /** 55 | * Get the next number with a given byte size. 56 | * @param {number} size the number of bytes to read. 57 | * @return {number} the corresponding number. 58 | */ 59 | readInt: function(size) { 60 | var result = 0, 61 | i; 62 | this.checkOffset(size); 63 | for (i = this.index + size - 1; i >= this.index; i--) { 64 | result = (result << 8) + this.byteAt(i); 65 | } 66 | this.index += size; 67 | return result; 68 | }, 69 | /** 70 | * Get the next string with a given byte size. 71 | * @param {number} size the number of bytes to read. 72 | * @return {string} the corresponding string. 73 | */ 74 | readString: function(size) { 75 | return utils.transformTo("string", this.readData(size)); 76 | }, 77 | /** 78 | * Get raw data without conversion, bytes. 79 | * @param {number} size the number of bytes to read. 80 | * @return {Object} the raw data, implementation specific. 81 | */ 82 | readData: function(size) { 83 | // see implementations 84 | }, 85 | /** 86 | * Find the last occurence of a zip signature (4 bytes). 87 | * @param {string} sig the signature to find. 88 | * @return {number} the index of the last occurence, -1 if not found. 89 | */ 90 | lastIndexOfSignature: function(sig) { 91 | // see implementations 92 | }, 93 | /** 94 | * Read the signature (4 bytes) at the current position and compare it with sig. 95 | * @param {string} sig the expected signature 96 | * @return {boolean} true if the signature matches, false otherwise. 97 | */ 98 | readAndCheckSignature: function(sig) { 99 | // see implementations 100 | }, 101 | /** 102 | * Get the next date. 103 | * @return {Date} the date. 104 | */ 105 | readDate: function() { 106 | var dostime = this.readInt(4); 107 | return new Date(Date.UTC( 108 | ((dostime >> 25) & 0x7f) + 1980, // year 109 | ((dostime >> 21) & 0x0f) - 1, // month 110 | (dostime >> 16) & 0x1f, // day 111 | (dostime >> 11) & 0x1f, // hour 112 | (dostime >> 5) & 0x3f, // minute 113 | (dostime & 0x1f) << 1)); // second 114 | } 115 | }; 116 | module.exports = DataReader; 117 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/reader/NodeBufferReader.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var Uint8ArrayReader = require('./Uint8ArrayReader'); 3 | var utils = require('../utils'); 4 | 5 | function NodeBufferReader(data) { 6 | Uint8ArrayReader.call(this, data); 7 | } 8 | utils.inherits(NodeBufferReader, Uint8ArrayReader); 9 | 10 | /** 11 | * @see DataReader.readData 12 | */ 13 | NodeBufferReader.prototype.readData = function(size) { 14 | this.checkOffset(size); 15 | var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); 16 | this.index += size; 17 | return result; 18 | }; 19 | module.exports = NodeBufferReader; 20 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/reader/StringReader.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var DataReader = require('./DataReader'); 3 | var utils = require('../utils'); 4 | 5 | function StringReader(data) { 6 | DataReader.call(this, data); 7 | } 8 | utils.inherits(StringReader, DataReader); 9 | /** 10 | * @see DataReader.byteAt 11 | */ 12 | StringReader.prototype.byteAt = function(i) { 13 | return this.data.charCodeAt(this.zero + i); 14 | }; 15 | /** 16 | * @see DataReader.lastIndexOfSignature 17 | */ 18 | StringReader.prototype.lastIndexOfSignature = function(sig) { 19 | return this.data.lastIndexOf(sig) - this.zero; 20 | }; 21 | /** 22 | * @see DataReader.readAndCheckSignature 23 | */ 24 | StringReader.prototype.readAndCheckSignature = function (sig) { 25 | var data = this.readData(4); 26 | return sig === data; 27 | }; 28 | /** 29 | * @see DataReader.readData 30 | */ 31 | StringReader.prototype.readData = function(size) { 32 | this.checkOffset(size); 33 | // this will work because the constructor applied the "& 0xff" mask. 34 | var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); 35 | this.index += size; 36 | return result; 37 | }; 38 | module.exports = StringReader; 39 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/reader/Uint8ArrayReader.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var ArrayReader = require('./ArrayReader'); 3 | var utils = require('../utils'); 4 | 5 | function Uint8ArrayReader(data) { 6 | ArrayReader.call(this, data); 7 | } 8 | utils.inherits(Uint8ArrayReader, ArrayReader); 9 | /** 10 | * @see DataReader.readData 11 | */ 12 | Uint8ArrayReader.prototype.readData = function(size) { 13 | this.checkOffset(size); 14 | if(size === 0) { 15 | // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of []. 16 | return new Uint8Array(0); 17 | } 18 | var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size); 19 | this.index += size; 20 | return result; 21 | }; 22 | module.exports = Uint8ArrayReader; 23 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/reader/readerFor.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('../utils'); 4 | var support = require('../support'); 5 | var ArrayReader = require('./ArrayReader'); 6 | var StringReader = require('./StringReader'); 7 | var NodeBufferReader = require('./NodeBufferReader'); 8 | var Uint8ArrayReader = require('./Uint8ArrayReader'); 9 | 10 | /** 11 | * Create a reader adapted to the data. 12 | * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read. 13 | * @return {DataReader} the data reader. 14 | */ 15 | module.exports = function (data) { 16 | var type = utils.getTypeOf(data); 17 | utils.checkSupport(type); 18 | if (type === "string" && !support.uint8array) { 19 | return new StringReader(data); 20 | } 21 | if (type === "nodebuffer") { 22 | return new NodeBufferReader(data); 23 | } 24 | if (support.uint8array) { 25 | return new Uint8ArrayReader(utils.transformTo("uint8array", data)); 26 | } 27 | return new ArrayReader(utils.transformTo("array", data)); 28 | }; 29 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/signature.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | exports.LOCAL_FILE_HEADER = "PK\x03\x04"; 3 | exports.CENTRAL_FILE_HEADER = "PK\x01\x02"; 4 | exports.CENTRAL_DIRECTORY_END = "PK\x05\x06"; 5 | exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07"; 6 | exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06"; 7 | exports.DATA_DESCRIPTOR = "PK\x07\x08"; 8 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/stream/ConvertWorker.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var GenericWorker = require('./GenericWorker'); 4 | var utils = require('../utils'); 5 | 6 | /** 7 | * A worker which convert chunks to a specified type. 8 | * @constructor 9 | * @param {String} destType the destination type. 10 | */ 11 | function ConvertWorker(destType) { 12 | GenericWorker.call(this, "ConvertWorker to " + destType); 13 | this.destType = destType; 14 | } 15 | utils.inherits(ConvertWorker, GenericWorker); 16 | 17 | /** 18 | * @see GenericWorker.processChunk 19 | */ 20 | ConvertWorker.prototype.processChunk = function (chunk) { 21 | this.push({ 22 | data : utils.transformTo(this.destType, chunk.data), 23 | meta : chunk.meta 24 | }); 25 | }; 26 | module.exports = ConvertWorker; 27 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/stream/Crc32Probe.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var GenericWorker = require('./GenericWorker'); 4 | var crc32 = require('../crc32'); 5 | var utils = require('../utils'); 6 | 7 | /** 8 | * A worker which calculate the crc32 of the data flowing through. 9 | * @constructor 10 | */ 11 | function Crc32Probe() { 12 | GenericWorker.call(this, "Crc32Probe"); 13 | this.withStreamInfo("crc32", 0); 14 | } 15 | utils.inherits(Crc32Probe, GenericWorker); 16 | 17 | /** 18 | * @see GenericWorker.processChunk 19 | */ 20 | Crc32Probe.prototype.processChunk = function (chunk) { 21 | this.streamInfo.crc32 = crc32(chunk.data, this.streamInfo.crc32 || 0); 22 | this.push(chunk); 23 | }; 24 | module.exports = Crc32Probe; 25 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/stream/DataLengthProbe.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('../utils'); 4 | var GenericWorker = require('./GenericWorker'); 5 | 6 | /** 7 | * A worker which calculate the total length of the data flowing through. 8 | * @constructor 9 | * @param {String} propName the name used to expose the length 10 | */ 11 | function DataLengthProbe(propName) { 12 | GenericWorker.call(this, "DataLengthProbe for " + propName); 13 | this.propName = propName; 14 | this.withStreamInfo(propName, 0); 15 | } 16 | utils.inherits(DataLengthProbe, GenericWorker); 17 | 18 | /** 19 | * @see GenericWorker.processChunk 20 | */ 21 | DataLengthProbe.prototype.processChunk = function (chunk) { 22 | if(chunk) { 23 | var length = this.streamInfo[this.propName] || 0; 24 | this.streamInfo[this.propName] = length + chunk.data.length; 25 | } 26 | GenericWorker.prototype.processChunk.call(this, chunk); 27 | }; 28 | module.exports = DataLengthProbe; 29 | 30 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/stream/DataWorker.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('../utils'); 4 | var GenericWorker = require('./GenericWorker'); 5 | 6 | // the size of the generated chunks 7 | // TODO expose this as a public variable 8 | var DEFAULT_BLOCK_SIZE = 16 * 1024; 9 | 10 | /** 11 | * A worker that reads a content and emits chunks. 12 | * @constructor 13 | * @param {Promise} dataP the promise of the data to split 14 | */ 15 | function DataWorker(dataP) { 16 | GenericWorker.call(this, "DataWorker"); 17 | var self = this; 18 | this.dataIsReady = false; 19 | this.index = 0; 20 | this.max = 0; 21 | this.data = null; 22 | this.type = ""; 23 | 24 | this._tickScheduled = false; 25 | 26 | dataP.then(function (data) { 27 | self.dataIsReady = true; 28 | self.data = data; 29 | self.max = data && data.length || 0; 30 | self.type = utils.getTypeOf(data); 31 | if(!self.isPaused) { 32 | self._tickAndRepeat(); 33 | } 34 | }, function (e) { 35 | self.error(e); 36 | }); 37 | } 38 | 39 | utils.inherits(DataWorker, GenericWorker); 40 | 41 | /** 42 | * @see GenericWorker.cleanUp 43 | */ 44 | DataWorker.prototype.cleanUp = function () { 45 | GenericWorker.prototype.cleanUp.call(this); 46 | this.data = null; 47 | }; 48 | 49 | /** 50 | * @see GenericWorker.resume 51 | */ 52 | DataWorker.prototype.resume = function () { 53 | if(!GenericWorker.prototype.resume.call(this)) { 54 | return false; 55 | } 56 | 57 | if (!this._tickScheduled && this.dataIsReady) { 58 | this._tickScheduled = true; 59 | utils.delay(this._tickAndRepeat, [], this); 60 | } 61 | return true; 62 | }; 63 | 64 | /** 65 | * Trigger a tick a schedule an other call to this function. 66 | */ 67 | DataWorker.prototype._tickAndRepeat = function() { 68 | this._tickScheduled = false; 69 | if(this.isPaused || this.isFinished) { 70 | return; 71 | } 72 | this._tick(); 73 | if(!this.isFinished) { 74 | utils.delay(this._tickAndRepeat, [], this); 75 | this._tickScheduled = true; 76 | } 77 | }; 78 | 79 | /** 80 | * Read and push a chunk. 81 | */ 82 | DataWorker.prototype._tick = function() { 83 | 84 | if(this.isPaused || this.isFinished) { 85 | return false; 86 | } 87 | 88 | var size = DEFAULT_BLOCK_SIZE; 89 | var data = null, nextIndex = Math.min(this.max, this.index + size); 90 | if (this.index >= this.max) { 91 | // EOF 92 | return this.end(); 93 | } else { 94 | switch(this.type) { 95 | case "string": 96 | data = this.data.substring(this.index, nextIndex); 97 | break; 98 | case "uint8array": 99 | data = this.data.subarray(this.index, nextIndex); 100 | break; 101 | case "array": 102 | case "nodebuffer": 103 | data = this.data.slice(this.index, nextIndex); 104 | break; 105 | } 106 | this.index = nextIndex; 107 | return this.push({ 108 | data : data, 109 | meta : { 110 | percent : this.max ? this.index / this.max * 100 : 0 111 | } 112 | }); 113 | } 114 | }; 115 | 116 | module.exports = DataWorker; 117 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/support.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.base64 = true; 4 | exports.array = true; 5 | exports.string = true; 6 | exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined"; 7 | exports.nodebuffer = typeof Buffer !== "undefined"; 8 | // contains true if JSZip can read/generate Uint8Array, false otherwise. 9 | exports.uint8array = typeof Uint8Array !== "undefined"; 10 | 11 | if (typeof ArrayBuffer === "undefined") { 12 | exports.blob = false; 13 | } 14 | else { 15 | var buffer = new ArrayBuffer(0); 16 | try { 17 | exports.blob = new Blob([buffer], { 18 | type: "application/zip" 19 | }).size === 0; 20 | } 21 | catch (e) { 22 | try { 23 | var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder; 24 | var builder = new Builder(); 25 | builder.append(buffer); 26 | exports.blob = builder.getBlob('application/zip').size === 0; 27 | } 28 | catch (e) { 29 | exports.blob = false; 30 | } 31 | } 32 | } 33 | 34 | try { 35 | exports.nodestream = !!require('readable-stream').Readable; 36 | } catch(e) { 37 | exports.nodestream = false; 38 | } 39 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/lib/zipObject.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var StreamHelper = require('./stream/StreamHelper'); 4 | var DataWorker = require('./stream/DataWorker'); 5 | var utf8 = require('./utf8'); 6 | var CompressedObject = require('./compressedObject'); 7 | var GenericWorker = require('./stream/GenericWorker'); 8 | 9 | /** 10 | * A simple object representing a file in the zip file. 11 | * @constructor 12 | * @param {string} name the name of the file 13 | * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data 14 | * @param {Object} options the options of the file 15 | */ 16 | var ZipObject = function(name, data, options) { 17 | this.name = name; 18 | this.dir = options.dir; 19 | this.date = options.date; 20 | this.comment = options.comment; 21 | this.unixPermissions = options.unixPermissions; 22 | this.dosPermissions = options.dosPermissions; 23 | 24 | this._data = data; 25 | this._dataBinary = options.binary; 26 | // keep only the compression 27 | this.options = { 28 | compression : options.compression, 29 | compressionOptions : options.compressionOptions 30 | }; 31 | }; 32 | 33 | ZipObject.prototype = { 34 | /** 35 | * Create an internal stream for the content of this object. 36 | * @param {String} type the type of each chunk. 37 | * @return StreamHelper the stream. 38 | */ 39 | internalStream: function (type) { 40 | var result = null, outputType = "string"; 41 | try { 42 | if (!type) { 43 | throw new Error("No output type specified."); 44 | } 45 | outputType = type.toLowerCase(); 46 | var askUnicodeString = outputType === "string" || outputType === "text"; 47 | if (outputType === "binarystring" || outputType === "text") { 48 | outputType = "string"; 49 | } 50 | result = this._decompressWorker(); 51 | 52 | var isUnicodeString = !this._dataBinary; 53 | 54 | if (isUnicodeString && !askUnicodeString) { 55 | result = result.pipe(new utf8.Utf8EncodeWorker()); 56 | } 57 | if (!isUnicodeString && askUnicodeString) { 58 | result = result.pipe(new utf8.Utf8DecodeWorker()); 59 | } 60 | } catch (e) { 61 | result = new GenericWorker("error"); 62 | result.error(e); 63 | } 64 | 65 | return new StreamHelper(result, outputType, ""); 66 | }, 67 | 68 | /** 69 | * Prepare the content in the asked type. 70 | * @param {String} type the type of the result. 71 | * @param {Function} onUpdate a function to call on each internal update. 72 | * @return Promise the promise of the result. 73 | */ 74 | async: function (type, onUpdate) { 75 | return this.internalStream(type).accumulate(onUpdate); 76 | }, 77 | 78 | /** 79 | * Prepare the content as a nodejs stream. 80 | * @param {String} type the type of each chunk. 81 | * @param {Function} onUpdate a function to call on each internal update. 82 | * @return Stream the stream. 83 | */ 84 | nodeStream: function (type, onUpdate) { 85 | return this.internalStream(type || "nodebuffer").toNodejsStream(onUpdate); 86 | }, 87 | 88 | /** 89 | * Return a worker for the compressed content. 90 | * @private 91 | * @param {Object} compression the compression object to use. 92 | * @param {Object} compressionOptions the options to use when compressing. 93 | * @return Worker the worker. 94 | */ 95 | _compressWorker: function (compression, compressionOptions) { 96 | if ( 97 | this._data instanceof CompressedObject && 98 | this._data.compression.magic === compression.magic 99 | ) { 100 | return this._data.getCompressedWorker(); 101 | } else { 102 | var result = this._decompressWorker(); 103 | if(!this._dataBinary) { 104 | result = result.pipe(new utf8.Utf8EncodeWorker()); 105 | } 106 | return CompressedObject.createWorkerFrom(result, compression, compressionOptions); 107 | } 108 | }, 109 | /** 110 | * Return a worker for the decompressed content. 111 | * @private 112 | * @return Worker the worker. 113 | */ 114 | _decompressWorker : function () { 115 | if (this._data instanceof CompressedObject) { 116 | return this._data.getContentWorker(); 117 | } else if (this._data instanceof GenericWorker) { 118 | return this._data; 119 | } else { 120 | return new DataWorker(this._data); 121 | } 122 | } 123 | }; 124 | 125 | var removedMethods = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"]; 126 | var removedFn = function () { 127 | throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); 128 | }; 129 | 130 | for(var i = 0; i < removedMethods.length; i++) { 131 | ZipObject.prototype[removedMethods[i]] = removedFn; 132 | } 133 | module.exports = ZipObject; 134 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jszip", 3 | "version": "3.1.5", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "colors": { 8 | "version": "0.6.2", 9 | "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", 10 | "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=", 11 | "dev": true 12 | }, 13 | "core-js": { 14 | "version": "3.0.0", 15 | "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.0.0.tgz", 16 | "integrity": "sha512-WBmxlgH2122EzEJ6GH8o9L/FeoUKxxxZ6q6VUxoTlsE4EvbTWKJb447eyVxTEuq0LpXjlq/kCB2qgBvsYRkLvQ==" 17 | }, 18 | "es6-promise": { 19 | "version": "4.2.6", 20 | "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz", 21 | "integrity": "sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==" 22 | }, 23 | "immediate": { 24 | "version": "3.0.6", 25 | "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", 26 | "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=" 27 | }, 28 | "inherits": { 29 | "version": "2.0.3", 30 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 31 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 32 | }, 33 | "jszip-utils": { 34 | "version": "0.0.2", 35 | "resolved": "https://registry.npmjs.org/jszip-utils/-/jszip-utils-0.0.2.tgz", 36 | "integrity": "sha1-RX1cvKYKHC4HBunaK1ROjnvFC/g=", 37 | "dev": true 38 | }, 39 | "lie": { 40 | "version": "3.3.0", 41 | "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", 42 | "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", 43 | "requires": { 44 | "immediate": "~3.0.5" 45 | } 46 | }, 47 | "optimist": { 48 | "version": "0.6.1", 49 | "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", 50 | "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", 51 | "dev": true, 52 | "requires": { 53 | "minimist": "~0.0.1", 54 | "wordwrap": "~0.0.2" 55 | }, 56 | "dependencies": { 57 | "minimist": { 58 | "version": "0.0.10", 59 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", 60 | "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", 61 | "dev": true 62 | } 63 | } 64 | }, 65 | "pako": { 66 | "version": "1.0.10", 67 | "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz", 68 | "integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==" 69 | }, 70 | "qunit-cli": { 71 | "version": "0.2.0", 72 | "resolved": "https://registry.npmjs.org/qunit-cli/-/qunit-cli-0.2.0.tgz", 73 | "integrity": "sha1-f+sPoj17WLYMHDU09qdLLJxSVss=", 74 | "dev": true, 75 | "requires": { 76 | "colors": "*", 77 | "object-assign": "^2.0.0", 78 | "optimist": ">=0.3", 79 | "qunitjs": "^1.15.0" 80 | }, 81 | "dependencies": { 82 | "object-assign": { 83 | "version": "2.1.1", 84 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-2.1.1.tgz", 85 | "integrity": "sha1-Q8NuXVaf+OSBbE76i+AtJpZ8GKo=", 86 | "dev": true 87 | } 88 | } 89 | }, 90 | "qunitjs": { 91 | "version": "1.23.1", 92 | "resolved": "https://registry.npmjs.org/qunitjs/-/qunitjs-1.23.1.tgz", 93 | "integrity": "sha1-GXHPl6yb4Bpk0jFVCNLkjm/U5xk=", 94 | "dev": true 95 | }, 96 | "readable-stream": { 97 | "version": "3.2.0", 98 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.2.0.tgz", 99 | "integrity": "sha512-RV20kLjdmpZuTF1INEb9IA3L68Nmi+Ri7ppZqo78wj//Pn62fCoJyV9zalccNzDD/OuJpMG4f+pfMl8+L6QdGw==", 100 | "requires": { 101 | "inherits": "^2.0.3", 102 | "string_decoder": "^1.1.1", 103 | "util-deprecate": "^1.0.1" 104 | } 105 | }, 106 | "safe-buffer": { 107 | "version": "5.1.1", 108 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", 109 | "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" 110 | }, 111 | "string_decoder": { 112 | "version": "1.2.0", 113 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz", 114 | "integrity": "sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==", 115 | "requires": { 116 | "safe-buffer": "~5.1.0" 117 | } 118 | }, 119 | "util-deprecate": { 120 | "version": "1.0.2", 121 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 122 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" 123 | }, 124 | "wordwrap": { 125 | "version": "0.0.2", 126 | "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", 127 | "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", 128 | "dev": true 129 | } 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jszip", 3 | "version": "3.1.5", 4 | "author": "Stuart Knightley ", 5 | "description": "Create, read and edit .zip files with JavaScript http://stuartk.com/jszip", 6 | "scripts": { 7 | "test": "npm run test-node && npm run test-browser", 8 | "test-node": "qunit-cli -c test/helpers/test-utils.js test/helpers/node-test-utils.js test/asserts/*.js", 9 | "test-browser": "grunt build && grunt test", 10 | "lint": "grunt jshint" 11 | }, 12 | "contributors": [ 13 | { 14 | "name": "Franz Buchinger" 15 | }, 16 | { 17 | "name": "António Afonso" 18 | }, 19 | { 20 | "name": "David Duponchel" 21 | }, 22 | { 23 | "name": "yiminghe" 24 | } 25 | ], 26 | "main": "./lib/index", 27 | "browser": { 28 | "readable-stream": "./lib/readable-stream-browser.js" 29 | }, 30 | "repository": { 31 | "type": "git", 32 | "url": "https://github.com/Stuk/jszip.git" 33 | }, 34 | "keywords": [ 35 | "zip", 36 | "deflate", 37 | "inflate" 38 | ], 39 | "devDependencies": { 40 | "grunt": "~1.0.4", 41 | "grunt-cli": "~1.3.2", 42 | "grunt-saucelabs": "9.0.1", 43 | "grunt-contrib-connect": "2.0.0", 44 | "jshint": "~2.10.2", 45 | "browserify": "~16.2.3", 46 | "grunt-browserify": "~5.3.0", 47 | "grunt-contrib-jshint": "~2.1.0", 48 | "grunt-contrib-qunit": "~3.1.0", 49 | "grunt-contrib-uglify": "~4.0.1", 50 | "phantomjs-prebuilt": "2.1.16", 51 | "jszip-utils": "~0.0.2", 52 | "package-json-versionify": "1.0.4", 53 | "qunit-cli": "~0.2.0", 54 | "qunitjs": "~2.4.1", 55 | "tmp": "0.1.0" 56 | }, 57 | "dependencies": { 58 | "core-js": "~3.0.0", 59 | "es6-promise": "~4.2.6", 60 | "lie": "~3.3.0", 61 | "pako": "~1.0.10", 62 | "readable-stream": "~3.2.0" 63 | }, 64 | "license": "(MIT OR GPL-3.0)" 65 | } 66 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/asserts/constructor.js: -------------------------------------------------------------------------------- 1 | /* jshint qunit: true */ 2 | /* global JSZip,JSZipTestUtils */ 3 | 'use strict'; 4 | 5 | QUnit.module("constructor"); 6 | 7 | test("JSZip exists", function(assert){ 8 | assert.ok(JSZip, "JSZip exists"); 9 | }); 10 | 11 | test("new JSZip()", function(assert){ 12 | var zip = new JSZip(); 13 | assert.ok(zip instanceof JSZip, "Constructor works"); 14 | }); 15 | 16 | test("JSZip()", function(assert){ 17 | var zip = JSZip(); // jshint ignore:line 18 | assert.ok(zip instanceof JSZip, "Constructor adds `new` before itself where necessary"); 19 | }); 20 | 21 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/asserts/delete.js: -------------------------------------------------------------------------------- 1 | /* jshint qunit: true */ 2 | /* global JSZip,JSZipTestUtils */ 3 | 'use strict'; 4 | 5 | QUnit.module("delete"); 6 | 7 | JSZipTestUtils.testZipFile("Delete file", "ref/text.zip", function(expected) { 8 | var zip = new JSZip(); 9 | zip.file("Remove.txt", "This file should be deleted\n"); 10 | zip.file("Hello.txt", "Hello World\n"); 11 | zip.remove("Remove.txt"); 12 | stop(); 13 | zip.generateAsync({type:"binarystring"}).then(function(actual) { 14 | ok(JSZipTestUtils.similar(actual, expected, JSZipTestUtils.MAX_BYTES_DIFFERENCE_PER_ZIP_ENTRY) , "Generated ZIP matches reference ZIP"); 15 | start(); 16 | })['catch'](JSZipTestUtils.assertNoError); 17 | }); 18 | 19 | JSZipTestUtils.testZipFile("Delete file in folder", "ref/folder.zip", function(expected) { 20 | var zip = new JSZip(); 21 | zip.folder("folder").file("Remove.txt", "This folder and file should be deleted\n"); 22 | zip.remove("folder/Remove.txt"); 23 | stop(); 24 | zip.generateAsync({type:"binarystring"}).then(function(actual) { 25 | ok(JSZipTestUtils.similar(actual, expected, JSZipTestUtils.MAX_BYTES_DIFFERENCE_PER_ZIP_ENTRY) , "Generated ZIP matches reference ZIP"); 26 | start(); 27 | })['catch'](JSZipTestUtils.assertNoError); 28 | }); 29 | 30 | JSZipTestUtils.testZipFile("Delete file in folder, with a relative path", "ref/folder.zip", function(expected) { 31 | var zip = new JSZip(); 32 | var folder = zip.folder("folder"); 33 | folder.file("Remove.txt", "This folder and file should be deleted\n"); 34 | folder.remove("Remove.txt"); 35 | stop(); 36 | zip.generateAsync({type:"binarystring"}).then(function(actual) { 37 | ok(JSZipTestUtils.similar(actual, expected, JSZipTestUtils.MAX_BYTES_DIFFERENCE_PER_ZIP_ENTRY) , "Generated ZIP matches reference ZIP"); 38 | start(); 39 | })['catch'](JSZipTestUtils.assertNoError); 40 | }); 41 | 42 | JSZipTestUtils.testZipFile("Delete folder", "ref/text.zip", function(expected) { 43 | var zip = new JSZip(); 44 | zip.folder("remove").file("Remove.txt", "This folder and file should be deleted\n"); 45 | zip.file("Hello.txt", "Hello World\n"); 46 | zip.remove("remove"); 47 | stop(); 48 | zip.generateAsync({type:"binarystring"}).then(function(actual) { 49 | ok(JSZipTestUtils.similar(actual, expected, JSZipTestUtils.MAX_BYTES_DIFFERENCE_PER_ZIP_ENTRY) , "Generated ZIP matches reference ZIP"); 50 | start(); 51 | })['catch'](JSZipTestUtils.assertNoError); 52 | }); 53 | 54 | JSZipTestUtils.testZipFile("Delete folder with a final /", "ref/text.zip", function(expected) { 55 | var zip = new JSZip(); 56 | zip.folder("remove").file("Remove.txt", "This folder and file should be deleted\n"); 57 | zip.file("Hello.txt", "Hello World\n"); 58 | zip.remove("remove/"); 59 | stop(); 60 | zip.generateAsync({type:"binarystring"}).then(function(actual) { 61 | ok(JSZipTestUtils.similar(actual, expected, JSZipTestUtils.MAX_BYTES_DIFFERENCE_PER_ZIP_ENTRY) , "Generated ZIP matches reference ZIP"); 62 | start(); 63 | })['catch'](JSZipTestUtils.assertNoError); 64 | }); 65 | 66 | JSZipTestUtils.testZipFile("Delete unknown path", "ref/text.zip", function(expected) { 67 | var zip = new JSZip(); 68 | zip.file("Hello.txt", "Hello World\n"); 69 | zip.remove("unknown_file"); 70 | zip.remove("unknown_folder/Hello.txt"); 71 | stop(); 72 | zip.generateAsync({type:"binarystring"}).then(function(actual) { 73 | ok(JSZipTestUtils.similar(actual, expected, JSZipTestUtils.MAX_BYTES_DIFFERENCE_PER_ZIP_ENTRY) , "Generated ZIP matches reference ZIP"); 74 | start(); 75 | })['catch'](JSZipTestUtils.assertNoError); 76 | }); 77 | 78 | JSZipTestUtils.testZipFile("Delete nested folders", "ref/text.zip", function(expected) { 79 | var zip = new JSZip(); 80 | zip.folder("remove").file("Remove.txt", "This folder and file should be deleted\n"); 81 | zip.folder("remove/second").file("Sub.txt", "This should be removed"); 82 | zip.file("remove/second/another.txt", "Another file"); 83 | zip.file("Hello.txt", "Hello World\n"); 84 | zip.remove("remove"); 85 | stop(); 86 | zip.generateAsync({type:"binarystring"}).then(function(actual) { 87 | ok(JSZipTestUtils.similar(actual, expected, JSZipTestUtils.MAX_BYTES_DIFFERENCE_PER_ZIP_ENTRY) , "Generated ZIP matches reference ZIP"); 88 | start(); 89 | })['catch'](JSZipTestUtils.assertNoError); 90 | }); 91 | 92 | JSZipTestUtils.testZipFile("Delete nested folders from relative path", "ref/folder.zip", function(expected) { 93 | var zip = new JSZip(); 94 | zip.folder("folder"); 95 | zip.folder("folder/1/2/3"); 96 | zip.folder("folder").remove("1"); 97 | stop(); 98 | zip.generateAsync({type:"binarystring"}).then(function(actual) { 99 | ok(JSZipTestUtils.similar(actual, expected, JSZipTestUtils.MAX_BYTES_DIFFERENCE_PER_ZIP_ENTRY) , "Generated ZIP matches reference ZIP"); 100 | JSZipTestUtils.checkGenerateStability(actual); 101 | start(); 102 | })['catch'](JSZipTestUtils.assertNoError); 103 | }); 104 | 105 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/asserts/deprecated.js: -------------------------------------------------------------------------------- 1 | /* jshint qunit: true */ 2 | /* global JSZip,JSZipTestUtils */ 3 | 'use strict'; 4 | 5 | QUnit.module("deprecated"); 6 | 7 | test("Removed load method throws an exception", function(assert) { 8 | var file = JSZipTestUtils.createZipAll().file("Hello.txt"); 9 | assert.throws( 10 | function() { 11 | new JSZip().load(""); 12 | }, 13 | /upgrade guide/, 14 | "load() throws an exception" 15 | ); 16 | }); 17 | test("Removed constructor with data throws an exception", function(assert) { 18 | var file = JSZipTestUtils.createZipAll().file("Hello.txt"); 19 | assert.throws( 20 | function() { 21 | var zip = new JSZip(""); 22 | }, 23 | /upgrade guide/, 24 | "new JSZip(data) throws an exception" 25 | ); 26 | }); 27 | test("Removed asText method throws an exception", function(assert) { 28 | var file = JSZipTestUtils.createZipAll().file("Hello.txt"); 29 | assert.throws( 30 | function() { 31 | file.asText(); 32 | }, 33 | /upgrade guide/, 34 | "file.asText() throws an exception" 35 | ); 36 | }); 37 | test("Removed generate method throws an exception", function(assert) { 38 | var file = JSZipTestUtils.createZipAll().file("Hello.txt"); 39 | assert.throws( 40 | function() { 41 | new JSZip().generate({type:"string"}); 42 | }, 43 | /upgrade guide/, 44 | "generate() throws an exception" 45 | ); 46 | }); 47 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/asserts/external.js: -------------------------------------------------------------------------------- 1 | /* jshint qunit: true */ 2 | /* global JSZip,JSZipTestUtils,Promise */ 3 | 'use strict'; 4 | 5 | QUnit.module("external"); 6 | 7 | /** 8 | * Creates a wrapper around an existing Promise implementation to count 9 | * calls and detect custom implementations. 10 | * @param {Promise} OriginalPromise the promise to wrap 11 | * @return {Promise} the wrapped promise 12 | */ 13 | function createPromiseProxy(OriginalPromise) { 14 | function MyShinyPromise (input) { 15 | if (input.then) { // thenable, we wrap it 16 | this._promise = input; 17 | } else { // executor 18 | this._promise = new OriginalPromise(input); 19 | } 20 | MyShinyPromise.calls++; 21 | } 22 | MyShinyPromise.calls = 0; 23 | MyShinyPromise.prototype = { 24 | then: function (onFulfilled, onRejected) { 25 | return new MyShinyPromise(this._promise.then(onFulfilled, onRejected)); 26 | }, 27 | "catch": function (onRejected) { 28 | return new MyShinyPromise(this._promise['catch'](onRejected)); 29 | }, 30 | isACustomImplementation: true 31 | }; 32 | 33 | MyShinyPromise.resolve = function (value) { 34 | return new MyShinyPromise(OriginalPromise.resolve(value)); 35 | }; 36 | MyShinyPromise.reject = function (value) { 37 | return new MyShinyPromise(OriginalPromise.reject(value)); 38 | }; 39 | MyShinyPromise.all = function (value) { 40 | return new MyShinyPromise(OriginalPromise.all(value)); 41 | }; 42 | return MyShinyPromise; 43 | } 44 | 45 | test("JSZip.external.Promise", function (assert) { 46 | assert.ok(JSZip.external.Promise, "JSZip.external.Promise is defined"); 47 | assert.ok(JSZip.external.Promise.resolve, "JSZip.external.Promise looks like a Promise"); 48 | assert.ok(JSZip.external.Promise.reject, "JSZip.external.Promise looks like a Promise"); 49 | }); 50 | 51 | test("load JSZip doesn't override the global Promise", function (assert) { 52 | if (typeof Promise !== "undefined"){ 53 | assert.equal(Promise, JSZipTestUtils.oldPromise, "the previous Promise didn't change"); 54 | assert.equal(Promise, JSZip.external.Promise, "JSZip.external.Promise reused the global Promise"); 55 | } else { 56 | assert.ok(JSZip.external.Promise, "JSZip.external.Promise is defined even if the global Promise doesn't exist"); 57 | } 58 | }); 59 | 60 | test("external.Promise can be replaced in .async()", function (assert) { 61 | var done = assert.async(); 62 | var OriginalPromise = JSZip.external.Promise; 63 | var MyShinyPromise = createPromiseProxy(OriginalPromise); 64 | 65 | JSZip.external.Promise = MyShinyPromise; 66 | 67 | var promise = JSZipTestUtils.createZipAll().file("Hello.txt").async("string").then(function (result) { 68 | ok(MyShinyPromise.calls > 0, "at least 1 call of the new Promise"); 69 | JSZip.external.Promise = OriginalPromise; 70 | done(); 71 | })['catch'](JSZipTestUtils.assertNoError); 72 | 73 | assert.ok(promise.isACustomImplementation, "the custom implementation is used"); 74 | }); 75 | 76 | test("external.Promise can be replaced in .generateAsync()", function (assert) { 77 | var done = assert.async(); 78 | var OriginalPromise = JSZip.external.Promise; 79 | var MyShinyPromise = createPromiseProxy(OriginalPromise); 80 | 81 | JSZip.external.Promise = MyShinyPromise; 82 | 83 | var promise = JSZipTestUtils.createZipAll().generateAsync({type:"string"}).then(function (result) { 84 | ok(MyShinyPromise.calls > 0, "at least 1 call of the new Promise"); 85 | JSZip.external.Promise = OriginalPromise; 86 | done(); 87 | })['catch'](JSZipTestUtils.assertNoError); 88 | 89 | assert.ok(promise.isACustomImplementation, "the custom implementation is used"); 90 | }); 91 | 92 | JSZipTestUtils.testZipFile("external.Promise can be replaced in .loadAsync()", "ref/all.zip", function (all) { 93 | stop(); 94 | var OriginalPromise = JSZip.external.Promise; 95 | var MyShinyPromise = createPromiseProxy(OriginalPromise); 96 | 97 | JSZip.external.Promise = MyShinyPromise; 98 | 99 | var promise = JSZip.loadAsync(all).then(function (result) { 100 | ok(MyShinyPromise.calls > 0, "at least 1 call of the new Promise"); 101 | JSZip.external.Promise = OriginalPromise; 102 | start(); 103 | })['catch'](JSZipTestUtils.assertNoError); 104 | 105 | ok(promise.isACustomImplementation, "the custom implementation is used"); 106 | }); 107 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/asserts/filter.js: -------------------------------------------------------------------------------- 1 | /* jshint qunit: true */ 2 | /* global JSZip,JSZipTestUtils */ 3 | 'use strict'; 4 | 5 | QUnit.module("filter"); 6 | 7 | test("Filtering a zip", function() { 8 | var zip = new JSZip(); 9 | zip.file("1.txt", "1\n"); 10 | zip.file("2.txt", "2\n"); 11 | zip.file("3.log", "3\n"); 12 | var result = zip.filter(function (relativeFilename, file){ 13 | return relativeFilename.indexOf(".txt") !== -1; 14 | }); 15 | equal(result.length, 2, "filter has filtered"); 16 | ok(result[0].name.indexOf(".txt") !== -1, "filter has filtered the good file"); 17 | ok(result[1].name.indexOf(".txt") !== -1, "filter has filtered the good file"); 18 | }); 19 | 20 | test("Filtering a zip from a relative path", function() { 21 | var zip = new JSZip(); 22 | zip.file("foo/1.txt", "1\n"); 23 | zip.file("foo/2.txt", "2\n"); 24 | zip.file("foo/3.log", "3\n"); 25 | zip.file("1.txt", "1\n"); 26 | zip.file("2.txt", "2\n"); 27 | zip.file("3.log", "3\n"); 28 | 29 | var count = 0; 30 | var result = zip.folder("foo").filter(function (relativeFilename, file) { 31 | count++; 32 | return relativeFilename.indexOf("3") !== -1; 33 | }); 34 | equal(count, 3, "the callback has been called the right number of times"); 35 | equal(result.length, 1, "filter has filtered"); 36 | equal(result[0].name, "foo/3.log", "filter has filtered the good file"); 37 | }); 38 | 39 | test("Filtering a zip : the full path is still accessible", function() { 40 | var zip = new JSZip(); 41 | zip.file("foo/1.txt", "1\n"); 42 | zip.file("foo/2.txt", "2\n"); 43 | zip.file("foo/3.log", "3\n"); 44 | zip.file("1.txt", "1\n"); 45 | zip.file("2.txt", "2\n"); 46 | zip.file("3.log", "3\n"); 47 | 48 | var result = zip.folder("foo").filter(function (relativeFilename, file) { 49 | return file.name.indexOf("3") !== -1; 50 | }); 51 | equal(result.length, 1, "the filter only match files/folders in the current folder"); 52 | equal(result[0].name, "foo/3.log", "filter has filtered the good file"); 53 | }); 54 | 55 | 56 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/asserts/foreach.js: -------------------------------------------------------------------------------- 1 | /* jshint qunit: true */ 2 | /* global JSZip,JSZipTestUtils */ 3 | 'use strict'; 4 | 5 | QUnit.module("forEach"); 6 | 7 | test("forEach works on /", function (assert) { 8 | var zip = JSZipTestUtils.createZipAll(); 9 | var count = 0; 10 | var calls = []; 11 | 12 | assert.equal(zip.root, ""); 13 | 14 | zip.forEach(function (path, elt) { 15 | assert.equal(path, elt.name, "the full path is given on / for " + elt.name); 16 | count++; 17 | calls.push(path); 18 | }); 19 | 20 | equal(count, 3, "the callback has been called the right number of times"); 21 | assert.deepEqual(calls, ["Hello.txt", "images/", "images/smile.gif"], "all paths have been called"); 22 | }); 23 | 24 | test("forEach works on a sub folder", function (assert) { 25 | var zip = new JSZip(); 26 | var sub = zip.folder("subfolder"); 27 | sub.file("Hello.txt", "Hello World\n"); 28 | sub.folder("images").file("smile.gif", "R0lGODdhBQAFAIACAAAAAP/eACwAAAAABQAFAAACCIwPkWerClIBADs=", {base64: true}); 29 | var count = 0; 30 | var calls = []; 31 | 32 | assert.ok(zip.file("subfolder/Hello.txt")); 33 | assert.equal(sub.root, "subfolder/"); 34 | 35 | sub.forEach(function (path, elt) { 36 | assert.equal(path, elt.name.substr("subfolder/".length), "the full path is given on subfolder/ for " + path); 37 | count++; 38 | calls.push(path); 39 | }); 40 | 41 | equal(count, 3, "the callback has been called the right number of times"); 42 | assert.deepEqual(calls, ["Hello.txt", "images/", "images/smile.gif"], "all paths have been called"); 43 | }); 44 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/asserts/version.js: -------------------------------------------------------------------------------- 1 | /* jshint qunit: true */ 2 | /* global JSZip,JSZipTestUtils */ 3 | 'use strict'; 4 | 5 | QUnit.module("version"); 6 | 7 | test("JSZip.version is correct", function(assert){ 8 | assert.ok(JSZip.version, "JSZip.version exists"); 9 | assert.ok(JSZip.version.match(/^\d+\.\d+\.\d+/), "JSZip.version looks like a correct version"); 10 | }); 11 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/helpers/browser-test-utils.js: -------------------------------------------------------------------------------- 1 | /* global JSZip,JSZipUtils,JSZipTestUtils */ 2 | 'use strict'; 3 | JSZipTestUtils.loadZipFile = function (name, callback) { 4 | JSZipUtils.getBinaryContent(name + "?_=" + ( new Date() ).getTime(), callback); 5 | }; 6 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/helpers/node-test-utils.js: -------------------------------------------------------------------------------- 1 | /* jshint qunit: true */ 2 | /* global JSZip,JSZipTestUtils */ 3 | 'use strict'; 4 | 5 | var fs = require("fs"); 6 | var path = require("path"); 7 | 8 | global.JSZip = require("../../lib/index"); 9 | 10 | global.JSZipTestUtils.loadZipFile = function(name, callback) { 11 | fs.readFile(path.join("test", name), "binary", callback); 12 | }; 13 | process.on('uncaughtException', function(err) { 14 | console.log('uncaughtException: ' + err, err.stack); 15 | process.exit(1); 16 | }); 17 | 18 | process.on('unhandledRejection', function(err) { 19 | console.log('unhandledRejection: ' + err, err.stack); 20 | process.exit(1); 21 | }); 22 | 23 | 24 | 25 | // Deprecated 26 | // Extend assert methods to QUnit and Global scope through Backwards compatibility 27 | (function() { 28 | function Assert( testContext ) { 29 | this.test = testContext; 30 | } 31 | Assert.prototype = QUnit.assert; 32 | var i, 33 | assertions = QUnit.assert; 34 | 35 | function applyCurrent( current ) { 36 | return function() { 37 | var assert = new Assert( QUnit.config.current ); 38 | current.apply( assert, arguments ); 39 | }; 40 | } 41 | 42 | for ( i in assertions ) { 43 | if (!assertions.hasOwnProperty(i)) { 44 | continue; 45 | } 46 | QUnit[ i ] = applyCurrent( assertions[ i ] ); 47 | global[ i ] = QUnit[ i ]; 48 | } 49 | })(); 50 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSZip Testing 6 | 7 | 8 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 57 | 58 | 59 | 62 | 65 | 66 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 |
    93 |
    94 | 95 | 96 | -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/all-stream.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/all-stream.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/all.7zip.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/all.7zip.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/all.windows.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/all.windows.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/all.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/all.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/all_appended_bytes.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/all_appended_bytes.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/all_missing_bytes.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/all_missing_bytes.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/all_prepended_bytes.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/all_prepended_bytes.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/archive_comment.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/archive_comment.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/backslash.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/backslash.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/complex_files/AntarcticaTemps.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/complex_files/AntarcticaTemps.ods -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/complex_files/AntarcticaTemps.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/complex_files/AntarcticaTemps.xlsx -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/complex_files/Franz Kafka - The Metamorphosis.epub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/complex_files/Franz Kafka - The Metamorphosis.epub -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/complex_files/Outlook2007_Calendar.xps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/complex_files/Outlook2007_Calendar.xps -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/data_descriptor.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/data_descriptor.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/deflate-stream.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/deflate-stream.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/deflate.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/deflate.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/empty.zip: -------------------------------------------------------------------------------- 1 | PK -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/encrypted.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/encrypted.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/extra_attributes.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/extra_attributes.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/folder.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/folder.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/image.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/image.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/invalid/bad_decompressed_size.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/invalid/bad_decompressed_size.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/invalid/bad_offset.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/invalid/bad_offset.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/invalid/compression.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/invalid/compression.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/invalid/crc32.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/invalid/crc32.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/local_encoding_in_name.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/local_encoding_in_name.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/nested.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/nested.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/nested_data_descriptor.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/nested_data_descriptor.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/nested_zip64.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/nested_zip64.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/linux_7z.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/linux_7z.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/linux_ark.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/linux_ark.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/linux_file_roller-ubuntu.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/linux_file_roller-ubuntu.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/linux_file_roller-xubuntu.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/linux_file_roller-xubuntu.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/linux_zip.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/linux_zip.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/mac_finder.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/mac_finder.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/windows_7z.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/windows_7z.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/windows_compressed_folders.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/windows_compressed_folders.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/windows_izarc.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/windows_izarc.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/windows_winrar.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/permissions/windows_winrar.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/pile_of_poo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/pile_of_poo.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/slashes_and_izarc.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/slashes_and_izarc.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/store-stream.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/store-stream.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/store.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/store.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/subfolder.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/subfolder.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/text.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/text.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/utf8.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/utf8.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/utf8_in_name.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/utf8_in_name.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/winrar_utf8_in_name.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/winrar_utf8_in_name.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/zip64.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/zip64.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/zip64_appended_bytes.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/zip64_appended_bytes.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/zip64_missing_bytes.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/zip64_missing_bytes.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/ref/zip64_prepended_bytes.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/ref/zip64_prepended_bytes.zip -------------------------------------------------------------------------------- /web/crx/lib/Stuk-jszip-9fb481a/test/smile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/lib/Stuk-jszip-9fb481a/test/smile.gif -------------------------------------------------------------------------------- /web/crx/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Scratcher's AtCoder", 3 | "short_name": "ScratchersAC", 4 | "description" : "for Scratchers who want to compete in AtCoder", 5 | "version": "1.4.0", 6 | "manifest_version": 2, 7 | "homepage_url": "https://github.com/yos1up/scratch2cpp/tree/master/web/crx", 8 | "icons": { 9 | "16": "icon16.png", 10 | "48": "icon48.png", 11 | "128": "icon128.png" 12 | }, 13 | "browser_action": { 14 | "default_popup": "popup.html", 15 | "default_icon": "icon.png" 16 | }, 17 | "content_scripts": [ 18 | { 19 | "matches": ["https://atcoder.jp/contests/*/submit*", "https://atcoder.jp/contests/*/tasks/*", "https://atcoder.jp/contests/*/custom_test*"], 20 | "js": ["lib/jquery-3.3.1.min.js", "lib/Stuk-jszip-9fb481a/dist/jszip.js", "lib/Stuk-jszip-9fb481a/dist/jszip.min.js", "sb2_to_cpp.js", "sb3_to_cpp.js", "main.js"] 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /web/crx/popup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

    Scratcher's AtCoder

    4 | https://github.com/yos1up/scratch2cpp/web/crx/ 5 | 6 | 7 | -------------------------------------------------------------------------------- /web/crx/scrshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/scrshot.png -------------------------------------------------------------------------------- /web/crx/scrshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/scrshot2.png -------------------------------------------------------------------------------- /web/crx/scrshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/scrshot3.png -------------------------------------------------------------------------------- /web/crx/scrshot4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yos1up/scratch2cpp/e2fdc8b3f0b28656c7f709ab09abd4571921861b/web/crx/scrshot4.png --------------------------------------------------------------------------------