mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-30 22:52:24 +01:00
Update jszip.js to the latest git.
This commit is contained in:
parent
4392d43d7c
commit
c56e63e967
@ -16,7 +16,9 @@ Usage:
|
|||||||
base64zip = zip.generate();
|
base64zip = zip.generate();
|
||||||
|
|
||||||
**/
|
**/
|
||||||
"use strict";
|
// We use strict, but it should not be placed outside of a function because
|
||||||
|
// the environment is shared inside the browser.
|
||||||
|
// "use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Representation a of zip file in js
|
* Representation a of zip file in js
|
||||||
@ -93,8 +95,8 @@ JSZip.support = {
|
|||||||
catch(e) {}
|
catch(e) {}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var builder = new (window.BlobBuilder || window.WebKitBlobBuilder ||
|
var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder;
|
||||||
window.MozBlobBuilder || window.MSBlobBuilder)();
|
var builder = new BlobBuilder();
|
||||||
builder.append(buffer);
|
builder.append(buffer);
|
||||||
return builder.getBlob('application/zip').size === 0;
|
return builder.getBlob('application/zip').size === 0;
|
||||||
}
|
}
|
||||||
@ -161,7 +163,7 @@ JSZip.prototype = (function () {
|
|||||||
return file.asBinary();
|
return file.asBinary();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform this._data into a string.
|
* Transform this._data into a string.
|
||||||
@ -287,9 +289,11 @@ JSZip.prototype = (function () {
|
|||||||
*/
|
*/
|
||||||
var prepareFileAttrs = function (o) {
|
var prepareFileAttrs = function (o) {
|
||||||
o = o || {};
|
o = o || {};
|
||||||
|
/*jshint -W041 */
|
||||||
if (o.base64 === true && o.binary == null) {
|
if (o.base64 === true && o.binary == null) {
|
||||||
o.binary = true;
|
o.binary = true;
|
||||||
}
|
}
|
||||||
|
/*jshint +W041 */
|
||||||
o = extend(o, JSZip.defaults);
|
o = extend(o, JSZip.defaults);
|
||||||
o.date = o.date || new Date();
|
o.date = o.date || new Date();
|
||||||
if (o.compression !== null) o.compression = o.compression.toUpperCase();
|
if (o.compression !== null) o.compression = o.compression.toUpperCase();
|
||||||
@ -341,7 +345,9 @@ JSZip.prototype = (function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.files[name] = new ZipObject(name, data, o);
|
var object = new ZipObject(name, data, o);
|
||||||
|
this.files[name] = object;
|
||||||
|
return object;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -399,7 +405,7 @@ JSZip.prototype = (function () {
|
|||||||
} else if (file._data.compressionMethod === compression.magic) {
|
} else if (file._data.compressionMethod === compression.magic) {
|
||||||
result.compressedContent = file._data.getCompressedContent();
|
result.compressedContent = file._data.getCompressedContent();
|
||||||
} else {
|
} else {
|
||||||
content = file._data.getContent()
|
content = file._data.getContent();
|
||||||
// need to decompress / recompress
|
// need to decompress / recompress
|
||||||
result.compressedContent = compression.compress(JSZip.utils.transformTo(compression.compressInputType, content));
|
result.compressedContent = compression.compress(JSZip.utils.transformTo(compression.compressInputType, content));
|
||||||
}
|
}
|
||||||
@ -756,8 +762,9 @@ JSZip.prototype = (function () {
|
|||||||
case "nodebuffer" :
|
case "nodebuffer" :
|
||||||
writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length);
|
writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length);
|
||||||
break;
|
break;
|
||||||
case "base64" :
|
// case "base64" :
|
||||||
default : // case "string" :
|
// case "string" :
|
||||||
|
default :
|
||||||
writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length);
|
writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1066,8 +1073,8 @@ JSZip.compressions = {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// deprecated, browser only, old way
|
// deprecated, browser only, old way
|
||||||
var builder = new (window.BlobBuilder || window.WebKitBlobBuilder ||
|
var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder;
|
||||||
window.MozBlobBuilder || window.MSBlobBuilder)();
|
var builder = new BlobBuilder();
|
||||||
builder.append(buffer);
|
builder.append(buffer);
|
||||||
return builder.getBlob('application/zip');
|
return builder.getBlob('application/zip');
|
||||||
}
|
}
|
||||||
@ -1095,7 +1102,7 @@ JSZip.compressions = {
|
|||||||
*/
|
*/
|
||||||
function identity(input) {
|
function identity(input) {
|
||||||
return input;
|
return input;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill in an array with a string.
|
* Fill in an array with a string.
|
||||||
@ -1108,7 +1115,7 @@ JSZip.compressions = {
|
|||||||
array[i] = str.charCodeAt(i) & 0xFF;
|
array[i] = str.charCodeAt(i) & 0xFF;
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform an array-like object to a string.
|
* Transform an array-like object to a string.
|
||||||
@ -1165,7 +1172,7 @@ JSZip.compressions = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result.join("");
|
return result.join("");
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the data from an array-like to an other array-like.
|
* Copy the data from an array-like to an other array-like.
|
||||||
@ -1178,7 +1185,7 @@ JSZip.compressions = {
|
|||||||
arrayTo[i] = arrayFrom[i];
|
arrayTo[i] = arrayFrom[i];
|
||||||
}
|
}
|
||||||
return arrayTo;
|
return arrayTo;
|
||||||
};
|
}
|
||||||
|
|
||||||
// a matrix containing functions to transform everything into everything.
|
// a matrix containing functions to transform everything into everything.
|
||||||
var transform = {};
|
var transform = {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user