From 3d2fda7dd39e2363682f1fa353c951ab0d44ddfa Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Tue, 9 Feb 2016 18:40:49 +0100 Subject: Implemented URL query parsing for initial token /opa/?token=abcde --- .../jszip/documentation/_layouts/default.html | 158 +++++++++++++++++++++ .../jszip/documentation/api_jszip.md | 15 ++ .../jszip/documentation/api_jszip/constructor.md | 23 +++ .../documentation/api_jszip/constructor_load.md | 22 +++ .../jszip/documentation/api_jszip/file_data.md | 90 ++++++++++++ .../jszip/documentation/api_jszip/file_name.md | 46 ++++++ .../jszip/documentation/api_jszip/file_regex.md | 49 +++++++ .../jszip/documentation/api_jszip/filter.md | 43 ++++++ .../jszip/documentation/api_jszip/folder_data.md | 34 +++++ .../jszip/documentation/api_jszip/folder_regex.md | 40 ++++++ .../jszip/documentation/api_jszip/generate.md | 139 ++++++++++++++++++ .../jszip/documentation/api_jszip/load.md | 81 +++++++++++ .../jszip/documentation/api_jszip/remove.md | 37 +++++ .../jszip/documentation/api_jszip/support.md | 16 +++ .../jszip/documentation/api_zipobject.md | 37 +++++ .../jszip/documentation/contributing.md | 62 ++++++++ .../jszip/documentation/css/main.css | 24 ++++ .../jszip/documentation/css/pygments.css | 64 +++++++++ .../jszip/documentation/examples.md | 115 +++++++++++++++ .../documentation/examples/download-zip-file.html | 59 ++++++++ .../jszip/documentation/examples/downloader.html | 58 ++++++++ .../jszip/documentation/examples/downloader.js | 89 ++++++++++++ .../examples/get-binary-files-ajax.html | 43 ++++++ .../examples/read-local-file-api.html | 87 ++++++++++++ .../bower_components/jszip/documentation/faq.md | 19 +++ .../jszip/documentation/howto/read_zip.md | 152 ++++++++++++++++++++ .../jszip/documentation/howto/write_zip.md | 106 ++++++++++++++ .../jszip/documentation/limitations.md | 73 ++++++++++ .../jszip/documentation/upgrade_guide.md | 57 ++++++++ 29 files changed, 1838 insertions(+) create mode 100644 afb-client/bower_components/jszip/documentation/_layouts/default.html create mode 100644 afb-client/bower_components/jszip/documentation/api_jszip.md create mode 100644 afb-client/bower_components/jszip/documentation/api_jszip/constructor.md create mode 100644 afb-client/bower_components/jszip/documentation/api_jszip/constructor_load.md create mode 100644 afb-client/bower_components/jszip/documentation/api_jszip/file_data.md create mode 100644 afb-client/bower_components/jszip/documentation/api_jszip/file_name.md create mode 100644 afb-client/bower_components/jszip/documentation/api_jszip/file_regex.md create mode 100644 afb-client/bower_components/jszip/documentation/api_jszip/filter.md create mode 100644 afb-client/bower_components/jszip/documentation/api_jszip/folder_data.md create mode 100644 afb-client/bower_components/jszip/documentation/api_jszip/folder_regex.md create mode 100644 afb-client/bower_components/jszip/documentation/api_jszip/generate.md create mode 100644 afb-client/bower_components/jszip/documentation/api_jszip/load.md create mode 100644 afb-client/bower_components/jszip/documentation/api_jszip/remove.md create mode 100644 afb-client/bower_components/jszip/documentation/api_jszip/support.md create mode 100644 afb-client/bower_components/jszip/documentation/api_zipobject.md create mode 100644 afb-client/bower_components/jszip/documentation/contributing.md create mode 100644 afb-client/bower_components/jszip/documentation/css/main.css create mode 100644 afb-client/bower_components/jszip/documentation/css/pygments.css create mode 100644 afb-client/bower_components/jszip/documentation/examples.md create mode 100644 afb-client/bower_components/jszip/documentation/examples/download-zip-file.html create mode 100644 afb-client/bower_components/jszip/documentation/examples/downloader.html create mode 100644 afb-client/bower_components/jszip/documentation/examples/downloader.js create mode 100644 afb-client/bower_components/jszip/documentation/examples/get-binary-files-ajax.html create mode 100644 afb-client/bower_components/jszip/documentation/examples/read-local-file-api.html create mode 100644 afb-client/bower_components/jszip/documentation/faq.md create mode 100644 afb-client/bower_components/jszip/documentation/howto/read_zip.md create mode 100644 afb-client/bower_components/jszip/documentation/howto/write_zip.md create mode 100644 afb-client/bower_components/jszip/documentation/limitations.md create mode 100644 afb-client/bower_components/jszip/documentation/upgrade_guide.md (limited to 'afb-client/bower_components/jszip/documentation') diff --git a/afb-client/bower_components/jszip/documentation/_layouts/default.html b/afb-client/bower_components/jszip/documentation/_layouts/default.html new file mode 100644 index 0000000..d1694cf --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/_layouts/default.html @@ -0,0 +1,158 @@ + + + + + + + + {{page.title}} + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + {% if page.section and page.fullpage != true %} +
+ + {% endif %} +
+

{{page.title}}

+ + + + + {{content}} + + + + +
+
+
+ + + + diff --git a/afb-client/bower_components/jszip/documentation/api_jszip.md b/afb-client/bower_components/jszip/documentation/api_jszip.md new file mode 100644 index 0000000..1eb759c --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/api_jszip.md @@ -0,0 +1,15 @@ +--- +title: "JSZip API" +layout: default +section: api +--- + +An instance of JSZip represents a set of files. You can add them, remove them, +modify them. You can also import an existing zip file or generate one. + +### Attributes + +attribute name | type | description +---------------------|-------------|------------- +`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). +`comment` | string | the comment of the zip file. diff --git a/afb-client/bower_components/jszip/documentation/api_jszip/constructor.md b/afb-client/bower_components/jszip/documentation/api_jszip/constructor.md new file mode 100644 index 0000000..5564737 --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/api_jszip/constructor.md @@ -0,0 +1,23 @@ +--- +title: "new JSZip() or JSZip()" +layout: default +section: api +--- + +__Description__ : Create a new JSZip instance. + +__Arguments__ : None + +__Returns__ : A new JSZip. + +__Throws__ : Nothing. + + + +__Example__ + +```js +var zip = new JSZip(); +// same as +var zip = JSZip(); +``` diff --git a/afb-client/bower_components/jszip/documentation/api_jszip/constructor_load.md b/afb-client/bower_components/jszip/documentation/api_jszip/constructor_load.md new file mode 100644 index 0000000..4e6f7ed --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/api_jszip/constructor_load.md @@ -0,0 +1,22 @@ +--- +title: "new JSZip(data [,options]) or JSZip(data [,options])" +layout: default +section: api +--- + +This is a shortcut for + +```js +var zip = new JSZip(); +zip.load(data, options); +``` + +Please see the documentation of [load]({{site.baseurl}}/documentation/api_jszip/load.html). + +__Example__ + +```js +var zip = new JSZip(data, options); +// same as +var zip = JSZip(data, options); +``` diff --git a/afb-client/bower_components/jszip/documentation/api_jszip/file_data.md b/afb-client/bower_components/jszip/documentation/api_jszip/file_data.md new file mode 100644 index 0000000..69adecb --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/api_jszip/file_data.md @@ -0,0 +1,90 @@ +--- +title: "file(name, data [,options])" +layout: default +section: api +--- + +__Description__ : Add (or update) a file to the zip file. + +__Arguments__ + +name | type | description +--------------------|---------|------------ +name | string | the name of the file. You can specify folders in the name : the folder separator is a forward slash ("/"). +data | String/ArrayBuffer/Uint8Array/Buffer | the content of the file. +options | object | the options. + +Content of `options` : + +name | type | default | description +------------|---------|---------|------------ +base64 | boolean | `false` | set to `true` if the data is base64 encoded. For example image data from a `` element. Plain text and HTML do not need this option. +binary | boolean | `false` | set to `true` if the data should be treated as raw content, `false` if this is a text. If base64 is used, this defaults to `true`, if the data is not a string, this will be set to `true`. +date | date | the current date | the last modification date. +compression | string | null | If set, specifies compression method to use for this specific file. If not, the default file compression will be used, see [generate(options)]({{site.baseurl}}/documentation/api_jszip/generate.html). +compressionOptions | object | `null` | the options to use when compressing the file, see [generate(options)]({{site.baseurl}}/documentation/api_jszip/generate.html). +comment | string | null | The comment for this file. +optimizedBinaryString | boolean | `false` | Set to true if (and only if) the input is a "binary string" and has already been prepared with a 0xFF mask. +createFolders | boolean | `false` | Set to true if folders in the file path should be automatically created, otherwise there will only be virtual folders that represent the path to the file. +unixPermissions | 16 bits number | null | The UNIX permissions of the file, if any. +dosPermissions | 6 bits number | null | The DOS permissions of the file, if any. +dir | boolean | false | Set to true if this is a directory and content should be ignored. + +You shouldn't update the data given to this method : it is kept as it so any +update will impact the stored data. + +__For the permissions__ : + +The field `unixPermissions` also accepts a string representing the octal value : +"644", "755", etc. On nodejs you can use the `mode` attribute of +[nodejs' fs.Stats](http://nodejs.org/api/fs.html#fs_class_fs_stats). + +See also [the platform option of generate()]({{site.baseurl}}/documentation/api_jszip/generate.html). + +__About `dir`__ : + +If `dir` is true or if a permission says it's a folder, this entry be flagged +as a folder and the content will be ignored. + +__Returns__ : The current JSZip object, for chaining. + +__Throws__ : An exception if the data is not in a supported format. + + + +__Example__ + +```js +zip.file("Hello.txt", "Hello World\n"); + +// base64 +zip.file("smile.gif", "R0lGODdhBQAFAIACAAAAAP/eACwAAAAABQAFAAACCIwPkWerClIBADs=", {base64: true}); +// from an ajax call with xhr.responseType = 'arraybuffer' +zip.file("smile.gif", arraybufferFromXhr); +// or on nodejs +zip.file("smile.gif", fs.readFileSync("smile.gif")); + +zip.file("Xmas.txt", "Ho ho ho !", {date : new Date("December 25, 2007 00:00:01")}); +zip.file("folder/file.txt", "file in folder"); + +zip.file("animals.txt", "dog,platypus\n").file("people.txt", "james,sebastian\n"); + +// result : Hello.txt, smile.gif, Xmas.txt, animals.txt, people.txt, +// folder/, folder/file.txt +// In the above case, the "folder" folder will not have a 'D'irectory attribute or Method property. The +// folder only exists as part of the path to "file.txt". + +zip.file("folder/file.txt", "file in folder", {createFolders: true}); +// In this case, the "folder" folder WILL have a 'D'irectory attribute and a Method property of "store". +// It will exist whether or not "file.txt" is present. + +zip.file("script.sh", "echo 'hello world'", { + unixPermissions : "755" +}); +// when generated with platform:UNIX, the script.sh file will be executable +``` diff --git a/afb-client/bower_components/jszip/documentation/api_jszip/file_name.md b/afb-client/bower_components/jszip/documentation/api_jszip/file_name.md new file mode 100644 index 0000000..88b6d43 --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/api_jszip/file_name.md @@ -0,0 +1,46 @@ +--- +title: "file(name)" +layout: default +section: api +--- + +__Description__ : Get a file with the specified name. You can specify folders +in the name : the folder separator is a forward slash ("/"). + +__Arguments__ + +name | type | description +-----|--------|------------- +name | string | the name of the file. + +__Returns__ : An instance of [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html) representing +the file if any, `null` otherwise. + +__Throws__ : Nothing. + + + +__Examples__ + +```js +var zip = new JSZip(); +zip.file("file.txt", "content"); + +zip.file("file.txt").name // "file.txt" +zip.file("file.txt").asText() // "content" +zip.file("file.txt").options.dir // false + +// utf8 example +var zip = new JSZip(zipFromAjaxWithUTF8); +zip.file("amount.txt").asText() // "€15" +zip.file("amount.txt").asArrayBuffer() // an ArrayBuffer containing €15 encoded as utf8 +zip.file("amount.txt").asUint8Array() // an Uint8Array containing €15 encoded as utf8 + +// with folders +zip.folder("sub").file("file.txt", "content"); +zip.file("sub/file.txt"); // the file +// or +zip.folder("sub").file("file.txt") // the file +``` + + diff --git a/afb-client/bower_components/jszip/documentation/api_jszip/file_regex.md b/afb-client/bower_components/jszip/documentation/api_jszip/file_regex.md new file mode 100644 index 0000000..5dd2416 --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/api_jszip/file_regex.md @@ -0,0 +1,49 @@ +--- +title: "file(regex)" +layout: default +section: api +--- + +__Description__ : Search a file in the current folder and subfolders with a +[regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions). +The regex is tested against the relative filename. + +__Arguments__ + +name | type | description +------|--------|------------ +regex | RegExp | the regex to use. + +__Returns__ : An array of matching files (an empty array if none matched). Each +maching file is an instance of [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html). + +__Throws__ : Nothing. + + + +__Example__ + +```js +var zip = new JSZip(); +zip.file("file1.txt", "content"); +zip.file("file2.txt", "content"); + +zip.file(/file/); // array of size 2 + +// example with a relative path : +var folder = zip.folder("sub"); +folder + .file("file3.txt", "content") // relative path from folder : file3.txt + .file("file4.txt", "content"); // relative path from folder : file4.txt + +folder.file(/file/); // array of size 2 +folder.file(/^file/); // array of size 2, the relative paths start with file + +// arrays contain objects in the form: +// {name: "file2.txt", dir: false, asText : function () {...}, ...} +``` + + diff --git a/afb-client/bower_components/jszip/documentation/api_jszip/filter.md b/afb-client/bower_components/jszip/documentation/api_jszip/filter.md new file mode 100644 index 0000000..3afc435 --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/api_jszip/filter.md @@ -0,0 +1,43 @@ +--- +title: "filter(predicate)" +layout: default +section: api +--- + +__Description__ : Filter nested files/folders with the specified function. + +__Arguments__ + +name | type | description +----------|----------|------------ +predicate | function | the predicate to use. + +The predicate has the following signature : `function (relativePath, file) {...}` : + +name | type | description +-------------|-----------|------------ +relativePath | string | the filename and its path, reliatively to the current folder. +file | ZipObject | the file being tested. See [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html). + +The predicate must return true if the file should be included, false otherwise. + + +__Returns__ : An array of matching ZipObject. + +__Throws__ : Nothing. + + + +__Example__ + +```js +var zip = new JSZip().folder("dir"); +zip.file("readme.txt", "content"); +zip.filter(function (relativePath, file){ + // relativePath == "readme.txt" + // file = {name:"dir/readme.txt",options:{...},asText:function} + return true/false; +}); +``` + + diff --git a/afb-client/bower_components/jszip/documentation/api_jszip/folder_data.md b/afb-client/bower_components/jszip/documentation/api_jszip/folder_data.md new file mode 100644 index 0000000..9f8bd44 --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/api_jszip/folder_data.md @@ -0,0 +1,34 @@ +--- +title: "folder(name)" +layout: default +section: api +--- + +__Description__ : Create a directory if it doesn't exist, return a new JSZip +object with the new folder as root. + +See also [the `dir` option of file()]({{site.baseurl}}/documentation/api_jszip/file_data.html). + +__Arguments__ + +name | type | description +-----|--------|------------ +name | string | the name of the directory. + +__Returns__ : A new JSZip (for chaining), with the new folder as root. + +__Throws__ : Nothing. + + + +__Example__ + +```js +zip.folder("images"); +zip.folder("css").file("style.css", "body {background: #FF0000}"); +// or specify an absolute path (using forward slashes) +zip.file("css/font.css", "body {font-family: sans-serif}") + +// result : images/, css/, css/style.css, css/font.css +``` + diff --git a/afb-client/bower_components/jszip/documentation/api_jszip/folder_regex.md b/afb-client/bower_components/jszip/documentation/api_jszip/folder_regex.md new file mode 100644 index 0000000..8d9e021 --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/api_jszip/folder_regex.md @@ -0,0 +1,40 @@ +--- +title: "folder(regex)" +layout: default +section: api +--- + +__Description__ : Search a subdirectory in the current directory with a +[regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions). +The regex is tested against the relative path. + +__Arguments__ + +name | type | description +------|--------|------------ +regex | RegExp | the regex to use. + +__Returns__ : An array of matching folders (an empty array if none matched). +Each maching folder is an instance of [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html). + +__Throws__ : Nothing. + + + +__Example__ + +```js +var zip = new JSZip(); +zip.folder("home/Pierre/videos"); +zip.folder("home/Pierre/photos"); +zip.folder("home/Jean/videos"); +zip.folder("home/Jean/photos"); + +zip.folder(/videos/); // array of size 2 + +zip.folder("home/Jean").folder(/^vid/); // array of 1 +``` + diff --git a/afb-client/bower_components/jszip/documentation/api_jszip/generate.md b/afb-client/bower_components/jszip/documentation/api_jszip/generate.md new file mode 100644 index 0000000..7b00f97 --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/api_jszip/generate.md @@ -0,0 +1,139 @@ +--- +title: "generate(options)" +layout: default +section: api +--- + +__Description__ : Generates the complete zip file. + +__Arguments__ + +name | type | default | description +--------------------|---------|---------|------------ +options | object | | the options to generate the zip file : +options.base64 | boolean | false | **deprecated**, use `type` instead. If `type` is not used, set to `false` to get the result as a raw byte string, `true` to encode it as base64. +options.compression | string | `STORE` (no compression) | the default file compression method to use. Available methods are `STORE` and `DEFLATE`. You can also provide your own compression method. +options.compressionOptions | object | `null` | the options to use when compressing the file, see below. +options.type | string | `base64` | The type of zip to return, see below for the other types. +options.comment | string | | The comment to use for the zip file. +options.mimeType | string | `application/zip` | mime-type for the generated file. Useful when you need to generate a file with a different extension, ie: ".ods". +options.platform | string | `DOS` | The platform to use when generating the zip file. + +Possible values for `type` : + +* `base64` (default) : the result will be a string, the binary in a base64 form. +* `string` : the result will be a string in "binary" form, using 1 byte per char (2 bytes). +* `uint8array` : the result will be a Uint8Array containing the zip. This requires a compatible browser. +* `arraybuffer` : the result will be a ArrayBuffer containing the zip. This requires a compatible browser. +* `blob` : the result will be a Blob containing the zip. This requires a compatible browser. +* `nodebuffer` : the result will be a nodejs Buffer containing the zip. This requires nodejs. + +Note : when using type = "uint8array", "arraybuffer" or "blob", be sure to +check if the browser supports it (you can use [`JSZip.support`]({{site.baseurl}}/documentation/api_jszip/support.html)). + +The `compressionOptions` parameter depends on the compression type. With +`STORE` (no compression), this parameter is ignored. With `DEFLATE`, you can +give the compression level with `compressionOptions : {level:6}` (or any level +between 1 (best speed) and 9 (best compression)). + +Note : if the entry is *already* compressed (coming from a compressed zip file), +calling `generate()` with a different compression level won't update the entry. +The reason is simple : JSZip doesn't know how compressed the content was and +how to match the compression level with the implementation we use. + +Note for the `comment` option : the zip format has no flag or field to give the +encoding of this field and JSZip will use UTF-8. With non ASCII characters you +might get encoding issues if the file archiver doesn't use UTF-8 to decode the +comment. + +If not set, JSZip will use the field `comment` on its `options`. + +Possible values for `platform` : `DOS` and `UNIX`. It also accepts nodejs +`process.platform` values. +When using `DOS`, the attribute `dosPermissions` of each file is used. +When using `UNIX`, the attribute `unixPermissions` of each file is used. + +If you set the platform value on nodejs, be sure to use `process.platform`. +`fs.stats` returns a non executable mode for folders on windows, if you +force the platform to `UNIX` the generated zip file will have a strange +behavior on UNIX platforms. + +__Returns__ : The generated zip file. + +__Throws__ : An exception if the asked `type` is not available in the browser, +see [JSZip.support]({{site.baseurl}}/documentation/api_jszip/support.html). + + + +__Example__ + +```js +var content = zip.generate({type:"blob"}); +// see FileSaver.js +saveAs(content, "hello.zip"); +``` + +```js +var content = zip.generate({type:"base64"}); +location.href="data:application/zip;base64,"+content; +``` + +```js +var content = zip.generate({type:"nodebuffer"}); +require("fs").writeFile("hello.zip", content, function(err){/*...*/}); +``` + +```js +// on nodejs +zip.file(pathname, content, { + date: stat.mtime, + unixPermissions: stat.mode +}); + +// ... + +zip.generate({ + type: 'nodebuffer', + platform: process.platform +}); +``` + +```js +//This example will Generate a Open Document Spreasheet, with the correct mime type +var zip = new JSZip(); +zip.file("mimetype", "application/vnd.oasis.opendocument.spreadsheet"); +var conf2 = zip.folder("Configurations2"); +conf2.folder("acceleator"); +conf2.folder("images"); +conf2.folder("popupmenu"); +conf2.folder("statusbar"); +conf2.folder("floater"); +conf2.folder("menubar"); +conf2.folder("progressbar"); +conf2.folder("toolbar"); + +var manifest = "<..."; //xml containing manifest.xml +var styles = "<..."; //xml containing styles.xml +var settings = "<..."; //xml containing settings.xml +var meta = "<..."; //xml containing meta.xml +var content = "<..."; //xml containing content.xml + +var metaInf = zip.folder("META-INF"); +metaInf.file("manifest.xml", manifest); +zip.file("styles.xml", styles); +zip.file("settings.xml", settings); +zip.file("meta.xml", meta); +zip.file("content.xml", content); + +//Generate the file +var odsFile = zip.generate({type: "blob", mimeType: "application/ods", compression: "DEFLATE"}); + +var url = window.URL.createObjectURL(odsFile); +var link = document.getElementById("link"); //I suppose you'll have a link with this id :) +link.download = "testjs.ods"; +link.href = url; + + +``` + + diff --git a/afb-client/bower_components/jszip/documentation/api_jszip/load.md b/afb-client/bower_components/jszip/documentation/api_jszip/load.md new file mode 100644 index 0000000..a2f54ad --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/api_jszip/load.md @@ -0,0 +1,81 @@ +--- +title: "load(data [, options])" +layout: default +section: api +--- + +__Description__ : Read an existing zip and merge the data in the current JSZip +object at the current folder level. This technique has some limitations, see +[here]({{site.baseurl}}/documentation/limitations.html). + +__Arguments__ + +name | type | description +-------------------|--------|------------ +data | String/ArrayBuffer/Uint8Array/Buffer | the zip file +options | object | the options to load the zip file + +Content of `options` : + +name | type | default | description +------------------------------|---------|---------|------------ +options.base64 | boolean | false | set to `true` if the data is base64 encoded, `false` for binary. +options.checkCRC32 | boolean | false | set to `true` if the read data should be checked against its CRC32. +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. +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. + +You shouldn't update the data given to this method : it is kept as it so any +update will impact the stored data. + +Zip features supported by this method : + +* Compression (DEFLATE supported) +* zip with data descriptor +* ZIP64 +* UTF8 in file name, UTF8 in file content + +Zip features not (yet) supported : + +* password protected zip +* multi-volume zip + +__Returns__ : The current JSZip object. + +__Throws__ : An exception if the loaded data is not valid zip data or if it +uses features (multi volume, password protected, etc). + + + +__Example__ + +```js +var zip = new JSZip(); +zip.load(zipDataFromXHR); +``` + +```js +require("fs").readFile("hello.zip", function (err, data) { + if (err) throw err; + var zip = new JSZip(); + zip.load(data); +} +``` + +Using sub folders : + +```js +var zip = new JSZip(); +zip.folder("subfolder").load(data); +// the content of data will be loaded in subfolder/ +``` + diff --git a/afb-client/bower_components/jszip/documentation/api_jszip/remove.md b/afb-client/bower_components/jszip/documentation/api_jszip/remove.md new file mode 100644 index 0000000..af7aa78 --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/api_jszip/remove.md @@ -0,0 +1,37 @@ +--- +title: "remove(name)" +layout: default +section: api +--- + +__Description__ : Delete a file or folder (recursively). + +__Arguments__ + +name | type | description +-----|--------|------------ +name | string | the name of the file/folder to delete. + +__Returns__ : The current JSZip object. + +__Throws__ : Nothing. + + + +__Example__ + +```js +var zip = new JSZip(); +zip.file("Hello.txt", "Hello World\n"); +zip.file("temp.txt", "nothing").remove("temp.txt"); +// result : Hello.txt + +zip.folder("css").file("style.css", "body {background: #FF0000}"); +zip.remove("css"); +//result : empty zip +``` + + diff --git a/afb-client/bower_components/jszip/documentation/api_jszip/support.md b/afb-client/bower_components/jszip/documentation/api_jszip/support.md new file mode 100644 index 0000000..73d076f --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/api_jszip/support.md @@ -0,0 +1,16 @@ +--- +title: "JSZip.support" +layout: default +section: api +--- + +If the browser supports them, JSZip can take advantage of some "new" features : +ArrayBuffer, Blob, Uint8Array. To know if JSZip can use them, you can check the +JSZip.support object. It contains the following boolean properties : + +* `arraybuffer` : true if JSZip can read and generate ArrayBuffer, false otherwise. +* `uint8array` : true if JSZip can read and generate Uint8Array, false otherwise. +* `blob` : true if JSZip can generate Blob, false otherwise. +* `nodebuffer` : true if JSZip can read and generate nodejs Buffer, false otherwise. + + diff --git a/afb-client/bower_components/jszip/documentation/api_zipobject.md b/afb-client/bower_components/jszip/documentation/api_zipobject.md new file mode 100644 index 0000000..970fa8f --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/api_zipobject.md @@ -0,0 +1,37 @@ +--- +title: "ZipObject API" +layout: default +section: api +--- + +This represents an entry in the zip file. If the entry comes from an existing +archive previously [loaded]({{site.baseurl}}/documentation/api_jszip/load.html), the content +will be automatically decompressed/converted first. + +### Attributes + +attribute name | type | description +----------------------------|-------------|------------- +`name` | string | the absolute path of the file +`dir` | boolean | true if this is a directory +`date` | date | the last modification date +`comment` | string | the comment for this file +`unixPermissions` | 16 bits number | The UNIX permissions of the file, if any. +`dosPermissions` | 6 bits number | The DOS permissions of the file, if any. +`options` | object | the options of the file. The available options are : +`options.base64` | boolean | **Deprecated**, see [file(name, data [,options])]({{site.baseurl}}/documentation/api_jszip/file_data.html) +`options.binary` | boolean | **Deprecated**, see [file(name, data [,options])]({{site.baseurl}}/documentation/api_jszip/file_data.html) +`options.dir` | boolean | **Deprecated**, use `dir`. True if this is a directory +`options.date` | date | **Deprecated**, use `date`. See [file(name, data [,options])]({{site.baseurl}}/documentation/api_jszip/file_data.html) +`options.compression` | compression | see [file(name, data [,options])]({{site.baseurl}}/documentation/api_jszip/file_data.html) + + +### Getters + +method | return type | description +------------------|---------------|------------- +`asText()` | string | the content as an unicode string. +`asBinary()` | string | the content as binary string. +`asArrayBuffer()` | ArrayBuffer | need a [compatible browser]({{site.baseurl}}/documentation/api_jszip/support.html). +`asUint8Array()` | Uint8Array | need a [compatible browser]({{site.baseurl}}/documentation/api_jszip/support.html). +`asNodeBuffer()` | nodejs Buffer | need [nodejs]({{site.baseurl}}/documentation/api_jszip/support.html). diff --git a/afb-client/bower_components/jszip/documentation/contributing.md b/afb-client/bower_components/jszip/documentation/contributing.md new file mode 100644 index 0000000..f1b5dd3 --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/contributing.md @@ -0,0 +1,62 @@ +--- +title: Contributing +layout: default +section: main +--- + + +### Download the sources + +You should create a [Github](https://github.com/) account and +[fork the repository](https://help.github.com/articles/fork-a-repo) (you will +need one to create the pull request). + +If you just want the get the source code, you can use git and do +`git clone https://github.com/Stuk/jszip.git` to get the sources. You can also +download the latest sources [here](https://github.com/Stuk/jszip/archive/master.zip). + +### Building the project + +#### Code + +The dependencies are handled by npm, the first step is to run +`npm install` to get the dependencies. +JSZip uses Grunt to handle the build, [see here to install its CLI](http://gruntjs.com/getting-started). + +Here are the interesting build commands : + +* `grunt` will generate the final js file in dist/ and the minified version. +* `npm run test-node` will run the tests in nodejs. +* `npm run test-browser` will the tests in some browsers using SauceLabs, see + below. +* `npm run test` will run the tests in nodejs and in the browser. +* `npm run lint` will use jshint the check the source code. + +#### Documentation + +The documentation uses jekyll on gh-pages. To render the documentation, you +need to [install jekyll](http://jekyllrb.com/docs/installation/) and then run +`jekyll serve --baseurl ''`. + +### Testing the project + +To test JSZip in nodejs, use `npm run test-node`. + +To test JSZip in a browser, you can open the file `test/index.html` in the +browser you want to test. Don't forget to update the dist/ files with `grunt`. + +You can also test JSZip in a lot of browsers at once with +[SauceLabs](https://saucelabs.com/). You will need a SauceLabs account and two +variables into your environment. On linux, just use + +```bash +export SAUCE_USERNAME=your-saucelabs-username +export SAUCE_ACCESS_KEY=your-saucelabs-access-key +``` + +before running the `npm run test-browser` command. + +### Merging the changes + +If you have tested bug fixes or new features, you can open a +[pull request](https://help.github.com/articles/using-pull-requests) on Github. diff --git a/afb-client/bower_components/jszip/documentation/css/main.css b/afb-client/bower_components/jszip/documentation/css/main.css new file mode 100644 index 0000000..f2a368c --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/css/main.css @@ -0,0 +1,24 @@ +ul.nav ul { + list-style:none; + margin: 0; + padding: 0 0 0 25px; +} + +#downloader_application form { + margin-bottom: 10px; +} + +#downloader_application ul { + list-style-type: none; +} + +.browser_support th { + border-bottom-width: 3px !important; +} + +.support_ie {border-bottom-color: #0275BA !important;} +.support_ff {border-bottom-color: #DF7215 !important;} +.support_sf {border-bottom-color: #43B3E9 !important;} +.support_cr {border-bottom-color: #39B642 !important;} +.support_op {border-bottom-color: #C42122 !important;} +.support_nd {border-bottom-color: #8CC84B !important;} diff --git a/afb-client/bower_components/jszip/documentation/css/pygments.css b/afb-client/bower_components/jszip/documentation/css/pygments.css new file mode 100644 index 0000000..2086339 --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/css/pygments.css @@ -0,0 +1,64 @@ +/* Generated with : + * pygmentize -S default -f html > pygments.css + */ +.hll { background-color: #ffffcc } +.c { color: #408080; font-style: italic } /* Comment */ +.err { border: 1px solid #FF0000 } /* Error */ +.k { color: #008000; font-weight: bold } /* Keyword */ +.o { color: #666666 } /* Operator */ +.cm { color: #408080; font-style: italic } /* Comment.Multiline */ +.cp { color: #BC7A00 } /* Comment.Preproc */ +.c1 { color: #408080; font-style: italic } /* Comment.Single */ +.cs { color: #408080; font-style: italic } /* Comment.Special */ +.gd { color: #A00000 } /* Generic.Deleted */ +.ge { font-style: italic } /* Generic.Emph */ +.gr { color: #FF0000 } /* Generic.Error */ +.gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.gi { color: #00A000 } /* Generic.Inserted */ +.go { color: #888888 } /* Generic.Output */ +.gp { color: #000080; font-weight: bold } /* Generic.Prompt */ +.gs { font-weight: bold } /* Generic.Strong */ +.gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.gt { color: #0044DD } /* Generic.Traceback */ +.kc { color: #008000; font-weight: bold } /* Keyword.Constant */ +.kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ +.kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ +.kp { color: #008000 } /* Keyword.Pseudo */ +.kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ +.kt { color: #B00040 } /* Keyword.Type */ +.m { color: #666666 } /* Literal.Number */ +.s { color: #BA2121 } /* Literal.String */ +.na { color: #7D9029 } /* Name.Attribute */ +.nb { color: #008000 } /* Name.Builtin */ +.nc { color: #0000FF; font-weight: bold } /* Name.Class */ +.no { color: #880000 } /* Name.Constant */ +.nd { color: #AA22FF } /* Name.Decorator */ +.ni { color: #999999; font-weight: bold } /* Name.Entity */ +.ne { color: #D2413A; font-weight: bold } /* Name.Exception */ +.nf { color: #0000FF } /* Name.Function */ +.nl { color: #A0A000 } /* Name.Label */ +.nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ +.nt { color: #008000; font-weight: bold } /* Name.Tag */ +.nv { color: #19177C } /* Name.Variable */ +.ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ +.w { color: #bbbbbb } /* Text.Whitespace */ +.mf { color: #666666 } /* Literal.Number.Float */ +.mh { color: #666666 } /* Literal.Number.Hex */ +.mi { color: #666666 } /* Literal.Number.Integer */ +.mo { color: #666666 } /* Literal.Number.Oct */ +.sb { color: #BA2121 } /* Literal.String.Backtick */ +.sc { color: #BA2121 } /* Literal.String.Char */ +.sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ +.s2 { color: #BA2121 } /* Literal.String.Double */ +.se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ +.sh { color: #BA2121 } /* Literal.String.Heredoc */ +.si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ +.sx { color: #008000 } /* Literal.String.Other */ +.sr { color: #BB6688 } /* Literal.String.Regex */ +.s1 { color: #BA2121 } /* Literal.String.Single */ +.ss { color: #19177C } /* Literal.String.Symbol */ +.bp { color: #008000 } /* Name.Builtin.Pseudo */ +.vc { color: #19177C } /* Name.Variable.Class */ +.vg { color: #19177C } /* Name.Variable.Global */ +.vi { color: #19177C } /* Name.Variable.Instance */ +.il { color: #666666 } /* Literal.Number.Integer.Long */ diff --git a/afb-client/bower_components/jszip/documentation/examples.md b/afb-client/bower_components/jszip/documentation/examples.md new file mode 100644 index 0000000..01d6e2d --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/examples.md @@ -0,0 +1,115 @@ +--- +title: "How to use JSZip" +layout: default +section: example +--- + +An instance of JSZip represents a set of files. You can add them, remove them, +modify them. You can also import an existing zip file or generate one. + +### Getting the object + +#### In a browser + +For a browser, there are two interesting files : `dist/jszip.js` and +`dist/jszip.min.js` (include just one). + +If you use an AMD loader (RequireJS for example) JSZip will register itself : +you just have to put the js file at the right place, or configure the loader +(see [here for RequireJS](http://requirejs.org/docs/api.html#config-paths)). + +Without any loader, JSZip will declare in the global scope a variable named `JSZip`. + +#### In nodejs + +In nodejs, you can `require` it : + +```js +var JSZip = require("jszip"); +``` + +### Basic manipulations + +The first step is to create an instance of JSZip : + +```js +var zip = new JSZip(); +``` + +On this instance, we can add (and update) files and folders with +`.file(name, content)` and `.folder(name)`. +They return the current JSZip instance so you can chain the calls. + +```js +// create a file +zip.file("hello.txt", "Hello[p my)6cxsw2q"); +// oops, cat on keyboard. Fixing ! +zip.file("hello.txt", "Hello World\n"); + +// create a file and a folder +zip.file("nested/hello.txt", "Hello World\n"); +// same as +zip.folder("nested").file("hello.txt", "Hello World\n"); +``` + +With `.folder(name)`, the returned object has a different root : if you add files +on this object, you will put them in the created subfolder. This is just a +view, the added files will also be in the "root" object. + +```js +var photoZip = zip.folder("photos"); +// this call will create photos/README +photoZip.file("README", "a folder with photos"); +``` + +You can access the file content with `.file(name)` and +[its getters]({{site.baseurl}}/documentation/api_zipobject.html) : + +```js +zip.file("hello.txt").asText(); // "Hello World\n" + +if (JSZip.support.uint8array) { + zip.file("hello.txt").asUint8Array(); // Uint8Array { 0=72, 1=101, 2=108, more...} +} +``` + +You can also remove files or folders with `.remove(name)` : + +```js +zip.remove("photos/README"); +zip.remove("photos"); +// same as +zip.remove("photos"); // by removing the folder, you also remove its content. +``` + +### Generate a zip file + +With `.generate(options)` you can generate a zip file (not a real file but its +representation in memory). Check +[this page]({{site.baseurl}}/documentation/howto/write_zip.html) for more +informations on how to write / give the file to the user. + +```js +var content = null; +if (JSZip.support.uint8array) { + content = zip.generate({type : "uint8array"}); +} else { + content = zip.generate({type : "string"}); +} +``` + +### Read a zip file + +With `.load(data)` you can load a zip file. Check +[this page]({{site.baseurl}}/documentation/howto/read_zip.html) to see how to +do properly (it's more tricky that it seems). + +```js +var new_zip = new JSZip(); +// more files ! +new_zip.load(content); + +// you now have every files contained in the loaded zip +new_zip.file("hello.txt").asText(); // "Hello World\n" +``` + diff --git a/afb-client/bower_components/jszip/documentation/examples/download-zip-file.html b/afb-client/bower_components/jszip/documentation/examples/download-zip-file.html new file mode 100644 index 0000000..869a54e --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/examples/download-zip-file.html @@ -0,0 +1,59 @@ +--- +title: "Download the generated zip file" +layout: default +section: example +--- + +

Tip : check the source of the page !

+

The FileSaver API

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

The data URL

+
+ Does not work in IE, has restrictions on the length.
+ +
+ diff --git a/afb-client/bower_components/jszip/documentation/examples/downloader.html b/afb-client/bower_components/jszip/documentation/examples/downloader.html new file mode 100644 index 0000000..e3589db --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/examples/downloader.html @@ -0,0 +1,58 @@ +--- +title: "Mini app : Downloader" +layout: default +section: example +--- + +

Tip : check the source of the page !

+ +

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

+

+ This demo requires a recent browser, see + the howto. +

+ + + +
+

Please select your files

+
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+ + +
+ +

+ + +
+ + diff --git a/afb-client/bower_components/jszip/documentation/examples/downloader.js b/afb-client/bower_components/jszip/documentation/examples/downloader.js new file mode 100644 index 0000000..13903cc --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/examples/downloader.js @@ -0,0 +1,89 @@ +jQuery(function ($) { + "use strict"; + + /** + * Reset the message. + */ + function resetMessage () { + $("#result") + .removeClass() + .text(""); + } + /** + * show a successful message. + * @param {String} text the text to show. + */ + function showMessage(text) { + resetMessage(); + $("#result") + .addClass("alert alert-success") + .text(text); + } + /** + * show an error message. + * @param {String} text the text to show. + */ + function showError(text) { + resetMessage(); + $("#result") + .addClass("alert alert-danger") + .text(text); + } + + /** + * Fetch the content, add it to the JSZip object + * and use a jQuery deferred to hold the result. + * @param {String} url the url of the content to fetch. + * @param {String} filename the filename to use in the JSZip object. + * @param {JSZip} zip the JSZip instance. + * @return {jQuery.Deferred} the deferred containing the data. + */ + function deferredAddZip(url, filename, zip) { + var deferred = $.Deferred(); + JSZipUtils.getBinaryContent(url, function (err, data) { + if(err) { + deferred.reject(err); + } else { + zip.file(filename, data, {binary:true}); + deferred.resolve(data); + } + }); + return deferred; + } + + if(!JSZip.support.blob) { + showError("This demo works only with a recent browser !"); + return; + } + + var $form = $("#download_form").on("submit", function () { + + resetMessage(); + + var zip = new JSZip(); + var deferreds = []; + + // find every checked item + $(this).find(":checked").each(function () { + var $this = $(this); + var url = $this.data("url"); + var filename = url.replace(/.*\//g, ""); + deferreds.push(deferredAddZip(url, filename, zip)); + }); + + // when everything has been downloaded, we can trigger the dl + $.when.apply($, deferreds).done(function () { + var blob = zip.generate({type:"blob"}); + + // see FileSaver.js + saveAs(blob, "example.zip"); + + showMessage("done !"); + }).fail(function (err) { + showError(err); + }); + return false; + }); +}); + +// vim: set shiftwidth=4 softtabstop=4: diff --git a/afb-client/bower_components/jszip/documentation/examples/get-binary-files-ajax.html b/afb-client/bower_components/jszip/documentation/examples/get-binary-files-ajax.html new file mode 100644 index 0000000..ee7594e --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/examples/get-binary-files-ajax.html @@ -0,0 +1,43 @@ +--- +title: "Get a file with an ajax call" +layout: default +section: example +--- + +

Tip : check the source of the page !

+ +

With JSZipUtils

+
+ + diff --git a/afb-client/bower_components/jszip/documentation/examples/read-local-file-api.html b/afb-client/bower_components/jszip/documentation/examples/read-local-file-api.html new file mode 100644 index 0000000..da307c2 --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/examples/read-local-file-api.html @@ -0,0 +1,87 @@ +--- +title: "Reading a local file with the File API" +layout: default +section: example +--- + +

Choose the local(s) zip file(s)

+

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

+
+ + + + + + diff --git a/afb-client/bower_components/jszip/documentation/faq.md b/afb-client/bower_components/jszip/documentation/faq.md new file mode 100644 index 0000000..57059e2 --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/faq.md @@ -0,0 +1,19 @@ +--- +title: "Frequently Asked Questions" +layout: default +section: main +--- + +### "Corrupted zip or bug : unexpected signature" + +If you are sure that the zip file is correct, that error often comes from a +corrupted content. An ajax request, if not prepared correctly, will try to +decode the binary content as a text and corrupt it. See +[this page]({{site.baseurl}}/documentation/howto/read_zip.html). + +### My browser crashes / becomes unresponsive / never finish the execution + +That happens if you try to handle to much data. If possible, try again with a +small (some KB) zip file to see if your code is correct. See +[this page]({{site.baseurl}}/documentation/limitations.html) for more +informations. diff --git a/afb-client/bower_components/jszip/documentation/howto/read_zip.md b/afb-client/bower_components/jszip/documentation/howto/read_zip.md new file mode 100644 index 0000000..48a5240 --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/howto/read_zip.md @@ -0,0 +1,152 @@ +--- +title: "How to read a file" +layout: default +section: example +--- + +This page explains how to read an existing zip file or add a existing file into +the zip file. + + +### In the browser + +#### AJAX request + +Getting binary data with an ajax request is hard (mainly because of IE <= 9). +The easy way is to use [JSZipUtils.getBinaryContent](https://github.com/stuk/jszip-utils). +With JSZipUtils.getBinaryContent, you can do the following (see the +documentation for more examples) : + +```js +JSZipUtils.getBinaryContent('path/to/content.zip', function(err, data) { + if(err) { + throw err; // or handle err + } + + var zip = new JSZip(data); +}); +``` + +
+ +If you need to adapt an existing solution to what getBinaryContent does, here +are the details. When doing a XHR request (level 1, without setting the +`responseType`) the browser will try to interpret the response as a string and +decode it from its charset. To avoid this on Firefox/Chrome/Opera, you need to +set mime type : `xhr.overrideMimeType("text/plain; charset=x-user-defined");`. +On IE <= 9, this is harder. The overrideMimeType trick doesn't work so we need +to use [vbscript](http://stackoverflow.com/questions/1095102/how-do-i-load-binary-image-data-using-javascript-and-xmlhttprequest) +and non standard attributes. +On IE > 9, overrideMimeType doesn't work but xhr2 does. + +With [xhr 2](http://caniuse.com/xhr2), you can just set the responseType +attribute : `xhr.responseType = "arraybuffer";`. With this, the browser will +return an ArrayBuffer. + +#### Local files + +If the browser supports the [FileReader API](http://caniuse.com/filereader), +you can use it to read a zip file. JSZip can read ArrayBuffer, so you can use +`FileReader.readAsArrayBuffer(Blob)`, see this [example]({{site.baseurl}}/documentation/examples/read-local-file-api.html). + +### In nodejs + +JSZip can read Buffers so you can do the following : + +#### Local file + +```js +"use strict"; + +var fs = require("fs"); +var JSZip = require("jszip"); + +// read a zip file +fs.readFile("test.zip", function(err, data) { + if (err) throw err; + var zip = new JSZip(data); +}); + +// read a file and add it to a zip +fs.readFile("picture.png", function(err, data) { + if (err) throw err; + var zip = new JSZip(); + zip.file("picture.png", data); +}); +``` + +#### Remote file + +There are a lot of nodejs libraries doing http requests, from the built-in +[http](http://nodejs.org/docs/latest/api/http.html) to the +[npm packages](https://www.npmjs.org/browse/keyword/http). Here are two +examples, one with the default http API, the other with +[request](https://github.com/mikeal/request) (but you're free to use your +favorite library !). If possible, download the file as a Buffer (you will get +better performances). If it's not possible, you can fallback to a binary string +(the option is likely to be `encoding : "binary"`). + +##### With http : + +```js +"use strict"; + +var http = require("http"); +var url = require("url"); +var JSZip = require("jszip"); + +var req = http.get(url.parse("http://localhost/.../file.zip"), function (res) { + if (res.statusCode !== 200) { + console.log(res.statusCode); + // handle error + return; + } + var data = [], dataLen = 0; + + // don't set the encoding, it will break everything ! + // or, if you must, set it to null. In that case the chunk will be a string. + + res.on("data", function (chunk) { + data.push(chunk); + dataLen += chunk.length; + }); + + res.on("end", function () { + var buf = new Buffer(dataLen); + for (var i=0,len=data.length,pos=0; i + +#### Deprecated google gears + +[Franz Buchinger](http://www.picurl.org/blog/author/franz/) has written a +brilliant tutorial on [using JSZip with Google Gears](http://www.picurl.org/blog/2009/11/22/creating-zip-archives-with-gears) +([part 2](http://www.picurl.org/blog/2009/11/29/gearszipper-part2-adding-support-for-real-files-and-canvas-elements/)). +If you want to let your Gears users download several files at once I really +recommend having a look at some of his [examples](http://picurl.org/gears/zipper/). + + + +### In nodejs + +JSZip can generate Buffers so you can do the following : + +```js +var fs = require("fs"); +var JSZip = require("jszip"); + +var zip = new JSZip(); +// zip.file("file", content); +// ... and other manipulations + +var buffer = zip.generate({type:"nodebuffer"}); + +fs.writeFile("test.zip", buffer, function(err) { + if (err) throw err; +}); +``` + + diff --git a/afb-client/bower_components/jszip/documentation/limitations.md b/afb-client/bower_components/jszip/documentation/limitations.md new file mode 100644 index 0000000..62db22e --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/limitations.md @@ -0,0 +1,73 @@ +--- +title: "Limitations of JSZip" +layout: default +section: limitations +fullpage: true +--- + +### Not supported features + +All the features of zip files are not supported. Classic zip files will work +but encrypted zip, multi-volume, etc are not supported and the load() method +will throw an `Error`. + + +### ZIP64 and 32bit integers + +ZIP64 files can be loaded, but only if the zip file is not "too big". ZIP64 uses 64bits integers +but Javascript represents all numbers as +[64-bit double precision IEEE 754 floating point numbers](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf) +(see section 8.5). So, we have 53bits for integers and +[bitwise operations treat everything as 32bits](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators). +So if all the 64bits integers can fit into 32 bits integers, everything will be +fine. If it's not the case, you will have other problems anyway (see next +limitation). + +### Performance issues + +An other limitation comes from the browser (and the machine running the +browser). A compressed zip file of 10MB is "easily" opened by firefox / chrome +/ opera / IE10+ but will crash older IE. Also keep in mind that strings in +javascript are encoded in UTF-16 : a 10MB ascii text file will take 20MB of +memory. + +If you're having performance issues, please consider the following : + +* Don't use IE <= 9. Everything is better with typed arrays. +* Use typed arrays (Uint8Array, ArrayBuffer, etc) if possible : + * If you generate a zip file, you should use `type:"uint8array"` + (or blob, arraybuffer, nodebuffer). + * If you load the file from an ajax call, ask your XHR an ArrayBuffer. + Loading a string is asking for troubles. +* Don't use compression (see below). +* If you want to get the content of an ASCII file as a string, consider using + `asBinary()` instead of `asText()`. The transformation + "binary string" -> "unicode string" is a consuming process. + +Note about compression : +When reading a file, JSZip will store the content without decompressing it. +When generating a compressed file, JSZip will reuse if possible compressed +content : + +* If you read a zip file compressed with DEFLATE and call `generate` with the + DEFLATE compression, JSZip won't call the compression algorithms (same with + STORE everywhere.) +* If you read a zip file compressed with DEFLATE and call `generate` with the + STORE compression, JSZip will have to decompress everything. + +On IE <=9, typed arrays are not supported and the compression algorithm +will fallback on arrays. In that case, JSZip needs to convert the binary string +into an array, DEFLATE it and convert the result into a binary string. +You don't want that to happen. + +### The output zip will differ from the input zip + +Reading and generating a zip file won't give you back the same file. +Some data are discarded (file metadata) and other are added (subfolders). + +### Encodings support + +JSZip only supports utf8 : if the names of the files inside the zip are not in +utf8 (or ASCII), they won't be interpreted correctly. If the content is a text +not encoded with utf8 (or ASCII), the `asText()` method won't decode it +correctly. diff --git a/afb-client/bower_components/jszip/documentation/upgrade_guide.md b/afb-client/bower_components/jszip/documentation/upgrade_guide.md new file mode 100644 index 0000000..1dfac9c --- /dev/null +++ b/afb-client/bower_components/jszip/documentation/upgrade_guide.md @@ -0,0 +1,57 @@ +--- +title: Upgrade Guide +layout: default +section: main +--- + +### From 2.2.2 to 2.3.0 + +* On `ZipObject#options`, the attributes `date` and `dir` have been + deprecated and are now on `ZipObject`. +* On `ZipObject#options`, the attributes `base64` and `binary` have been + deprecated. +* `JSZip.base64`, `JSZip.prototype.crc32`, `JSZip.prototype.utf8decode`, + `JSZip.prototype.utf8encode` and `JSZip.utils` have been deprecated. + +```js +// deprecated +zip.file("test.txt").options.date +zip.file("test.txt").options.dir +// new API +zip.file("test.txt").date +zip.file("test.txt").dir +``` + + +### From 2.0.0 to 2.1.0 + +* The packaging changed : instead of loading jszip.js, jszip-load.js, + jszip-inflate.js, jszip-deflate.js, just include dist/jszip.js or + dist/jszip.min.js. + For AMD loader users : JSZip now registers itself. You just have to put the + file at the right place or configure your loader. + + +### From 1.x to 2.x + +* `JSZipBase64` has been renamed to `JSZip.base64`. +* The `data` attribute doesn't exist anymore : + use the getters `asText()`, `asBinary()`, etc +* The compression/decompression methods now give their input type with the + `compressInputType` and `uncompressInputType` attributes. + +Example for the data attribute : + +```js +// before +zip.file("test.txt").data; +zip.files["test.txt"].data; +zip.file("image.png").data; +zip.files["image.png"].data; + +// after +zip.file("test.txt").asText(); +zip.files["test.txt"].asText(); +zip.file("image.png").asBinary(); +zip.files["image.png"].asBinary(); +``` -- cgit 1.2.3-korg