diff --git a/.gitignore b/.gitignore
index bbbef0357..71251cf8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,6 +32,9 @@ _infrastructure/tests/build
#rx.js
!rx.js
+#zip.js
+!zip.js
+
node_modules
.sublimets
diff --git a/zip.js/zip.js-tests.ts b/zip.js/zip.js-tests.ts
new file mode 100644
index 000000000..b00654996
--- /dev/null
+++ b/zip.js/zip.js-tests.ts
@@ -0,0 +1,45 @@
+///
+
+// create the blob object storing the data to compress
+var blob: Blob = new Blob([ "Lorem ipsum dolor sit amet, consectetuer adipiscing elit..." ], {
+ type : "text/plain"
+});
+// creates a zip storing the file "lorem.txt" with blob as data
+// the zip will be stored into a Blob object (zippedBlob)
+zipBlob("lorem.txt", blob, function(zippedBlob: Blob) {
+ // unzip the first file from zipped data stored in zippedBlob
+ unzipBlob(zippedBlob, function(unzippedBlob: Blob) {
+ // logs the uncompressed Blob
+ console.log(unzippedBlob);
+ });
+});
+
+function zipBlob(filename: string, blob: Blob, callback: (blob: Blob) => void) {
+ // use a zip.BlobWriter object to write zipped data into a Blob object
+ zip.createWriter(new zip.BlobWriter("application/zip"), function(zipWriter) {
+ // use a BlobReader object to read the data stored into blob variable
+ zipWriter.add(filename, new zip.BlobReader(blob), function() {
+ // close the writer and calls callback function
+ zipWriter.close(callback);
+ });
+ }, theErrorHandler);
+}
+
+function unzipBlob(blob: Blob, callback: (unzippedBlob: Blob) => void) {
+ // use a zip.BlobReader object to read zipped data stored into blob variable
+ zip.createReader(new zip.BlobReader(blob), function(zipReader) {
+ // get entries from the zip file
+ zipReader.getEntries(function(entries: zip.Entry[]) {
+ // get data from the first file
+ entries[0].getData(new zip.BlobWriter("text/plain"), function(data: Blob) {
+ // close the reader and calls callback function with uncompressed data as parameter
+ zipReader.close();
+ callback(data);
+ });
+ });
+ }, theErrorHandler);
+}
+
+function theErrorHandler(message: any) {
+ console.error(message);
+}
\ No newline at end of file
diff --git a/zip.js/zip.js.d.ts b/zip.js/zip.js.d.ts
new file mode 100644
index 000000000..fa976dca9
--- /dev/null
+++ b/zip.js/zip.js.d.ts
@@ -0,0 +1,94 @@
+// Type definitions for zip.js 2.x
+// Project: https://github.com/gildas-lormeau/zip.js
+// Definitions by: Louis Grignon
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+interface FileEntry {}
+
+declare module zip {
+ export var useWebWorkers: boolean;
+ export var workerScriptsPath: string;
+ export var workerScripts: {
+ deflater?: string[];
+ inflater?: string[];
+ };
+
+ export class Reader {
+ public size: number;
+ public init(callback: () => void, onerror: (error: any) => void): void;
+ public readUint8Array(index: number, length: number, callback: (result: Uint8Array) => void, onerror?: (error: any) => void): void;
+ }
+
+ export class TextReader extends Reader {
+ constructor(text: string);
+ }
+
+ export class BlobReader extends Reader {
+ constructor(blob: Blob);
+ }
+
+ export class Data64URIReader extends Reader {
+ constructor(dataURI: string);
+ }
+
+ export class HttpReader extends Reader {
+ constructor(url: string);
+ }
+
+ export function createReader(reader: zip.Reader, callback: (zipReader: ZipReader) => void, onerror?: (error: any) => void): void;
+
+ export class ZipReader {
+ getEntries(callback: (entries: zip.Entry[]) => void): void;
+ close(callback?: () => void): void;
+ }
+
+ export interface Entry {
+ filename: string;
+ directory: boolean;
+ compressedSize: number;
+ uncompressedSize: number;
+ lastModDate: Date;
+ lastModDateRaw: number;
+ comment: string;
+ crc32: number;
+
+ getData(writer: zip.Writer, onend: (result: any) => void, onprogress?: (progress: number, total: number) => void, checkCrc32?: boolean): void;
+ }
+
+ export class Writer {
+ public init(callback: () => void, onerror?: (error: any) => void): void;
+ public writeUint8Array(array: Uint8Array, callback: () => void, onerror?: (error: any) => void): void;
+ public getData(callback: (data: any) => void, onerror?: (error: any) => void) : void;
+ }
+
+ export class TextWriter extends Writer {
+ constructor(encoding: string);
+ }
+
+ export class BlobWriter extends Writer {
+ constructor(contentType: string);
+ }
+
+ export class FileWriter extends Writer {
+ constructor(fileEntry: FileEntry);
+ }
+
+ export class Data64URIWriter extends Writer {
+ constructor(mimeString?: string);
+ }
+
+ export function createWriter(writer: zip.Writer, callback: (zipWriter: zip.ZipWriter) => void, onerror?: (error: any) => void, dontDeflate?: boolean): void;
+
+ export interface WriteOptions {
+ directory?: boolean;
+ level?: number;
+ comment?: string;
+ lastModDate?: Date;
+ version?: number;
+ }
+
+ export class ZipWriter {
+ public add(name: string, reader: zip.Reader, onend: () => void, onprogress?: (progress: number, total: number) => void, options?: WriteOptions): void;
+ public close(callback: (result: any) => void): void;
+ }
+}