Comparing version 1.3.6 to 1.4.0
@@ -1,2 +0,2 @@ | ||
/* unzipit@1.3.6, license MIT */ | ||
/* unzipit@1.4.0, license MIT */ | ||
(function (factory) { | ||
@@ -3,0 +3,0 @@ typeof define === 'function' && define.amd ? define(factory) : |
@@ -1,2 +0,2 @@ | ||
/* unzipit@1.3.6, license MIT */ | ||
/* unzipit@1.4.0, license MIT */ | ||
'use strict';(function(w){"function"===typeof define&&define.amd?define(w):w()})(function(){function w(a,b){var e=a.length;if(b<=e)return a;b=new Uint8Array(Math.max(e<<1,b));b.set(a,0);return b}function X(a,b,e,g){for(var f=0,c=0,m=g.length>>>1;c<e;){var p=a[c+b];g[c<<1]=0;g[(c<<1)+1]=p;p>f&&(f=p);c++}for(;c<m;)g[c<<1]=0,g[(c<<1)+1]=0,c++;return f}function z(a,b){var e=a.length,g,f;var c=d.bl_count;for(f=0;f<=b;f++)c[f]=0;for(f=1;f<e;f+=2)c[a[f]]++;f=d.next_code;var m=0;c[0]=0;for(g=1;g<=b;g++)m= | ||
@@ -3,0 +3,0 @@ m+c[g-1]<<1,f[g]=m;for(b=0;b<e;b+=2)c=a[b+1],0!=c&&(a[b]=f[c],f[c]++)}function A(a,b,e){for(var g=a.length,f=d.rev15,c=0;c<g;c+=2)if(0!=a[c+1]){var m=a[c+1],p=c>>1<<4|m,t=b-m;m=a[c]<<t;for(t=m+(1<<t);m!=t;)e[f[m]>>>15-b]=p,m++}}function Y(a,b){for(var e=d.rev15,g=15-b,f=0;f<a.length;f+=2)a[f]=e[a[f]<<b-a[f+1]]>>>g}function x(a,b,e){return(a[b>>>3]|a[(b>>>3)+1]<<8)>>>(b&7)&(1<<e)-1}function K(a,b,e){return(a[b>>>3]|a[(b>>>3)+1]<<8|a[(b>>>3)+2]<<16)>>>(b&7)&(1<<e)-1}function L(a,b){return(a[b>>>3]| |
@@ -1,2 +0,2 @@ | ||
/* unzipit@1.3.6, license MIT */ | ||
/* unzipit@1.4.0, license MIT */ | ||
function inflate(data, buf) { | ||
@@ -3,0 +3,0 @@ var u8=Uint8Array; |
@@ -33,2 +33,4 @@ export type ZipInfo = { | ||
encrypted: boolean, // True if encrypted | ||
externalFileAttributes: number, // platform specific file attributes | ||
versionMadeBy: number, // platform that made this file | ||
}; | ||
@@ -35,0 +37,0 @@ |
@@ -1,2 +0,2 @@ | ||
/* unzipit@1.3.6, license MIT */ | ||
/* unzipit@1.4.0, license MIT */ | ||
(function (global, factory) { | ||
@@ -698,2 +698,4 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
this.encrypted = !!(rawEntry.generalPurposeBitFlag & 0x1); | ||
this.externalFileAttributes = rawEntry.externalFileAttributes; | ||
this.versionMadeBy = rawEntry.versionMadeBy; | ||
} | ||
@@ -982,3 +984,3 @@ // returns a promise that returns a Blob for this entry | ||
if (!zip64ExtraField) { | ||
return new Error('expected zip64 extended information extra field'); | ||
throw new Error('expected zip64 extended information extra field'); | ||
} | ||
@@ -985,0 +987,0 @@ const zip64EiefBuffer = zip64ExtraField.data; |
@@ -1,2 +0,2 @@ | ||
/* unzipit@1.3.6, license MIT */ | ||
/* unzipit@1.4.0, license MIT */ | ||
'use strict';(function(z,G){"object"===typeof exports&&"undefined"!==typeof module?G(exports):"function"===typeof define&&define.amd?define(["exports"],G):(z="undefined"!==typeof globalThis?globalThis:z||self,G(z.unzipit={}))})(this,function(z){function G(a){return a.arrayBuffer?a.arrayBuffer():new Promise((b,c)=>{const e=new FileReader;e.addEventListener("loadend",()=>{b(e.result)});e.addEventListener("error",c);e.readAsArrayBuffer(a)})}async function na(a){a=await G(a);return new Uint8Array(a)} | ||
@@ -15,3 +15,3 @@ function aa(a){return"undefined"!==typeof Blob&&a instanceof Blob}function I(a){return"undefined"!==typeof SharedArrayBuffer&&a instanceof SharedArrayBuffer}function R(a,b){var c=a.length;if(b<=c)return a;b=new Uint8Array(Math.max(c<<1,b));b.set(a,0);return b}function oa(a,b,c,e,d,h){for(var k=ba,f=ca,l=0;l<c;){var n=a[f(e,d)&b];d+=n&15;var u=n>>>4;if(15>=u)h[l]=u,l++;else{var x=n=0;16==u?(x=3+k(e,d,2),d+=2,n=h[l-1]):17==u?(x=3+k(e,d,3),d+=3):18==u&&(x=11+k(e,d,7),d+=7);for(u=l+x;l<u;)h[l]=n,l++}}return d} | ||
30),fileCommentLength:v(f,32),internalFileAttributes:v(f,36),externalFileAttributes:w(f,38),relativeOffsetOfLocalHeader:w(f,42)};if(f.generalPurposeBitFlag&64)throw Error("strong encryption is not supported");k+=46;l=b.subarray(k,k+f.fileNameLength+f.extraFieldLength+f.fileCommentLength);f.nameBytes=l.slice(0,f.fileNameLength);f.name=M(f.nameBytes);var n=f.fileNameLength+f.extraFieldLength;const C=l.slice(f.fileNameLength,n);f.extraFields=[];for(var u=0;u<C.length-3;){const t=v(C,u+0);var x=v(C,u+ | ||
2);u+=4;x=u+x;if(x>C.length)throw Error("extra field length exceeds extra field buffer size");f.extraFields.push({id:t,data:C.slice(u,x)});u=x}f.commentBytes=l.slice(n,n+f.fileCommentLength);f.comment=M(f.commentBytes);k+=l.length;if(4294967295===f.uncompressedSize||4294967295===f.compressedSize||4294967295===f.relativeOffsetOfLocalHeader){l=f.extraFields.find(t=>1===t.id);if(!l)return Error("expected zip64 extended information extra field");l=l.data;n=0;if(4294967295===f.uncompressedSize){if(n+8> | ||
2);u+=4;x=u+x;if(x>C.length)throw Error("extra field length exceeds extra field buffer size");f.extraFields.push({id:t,data:C.slice(u,x)});u=x}f.commentBytes=l.slice(n,n+f.fileCommentLength);f.comment=M(f.commentBytes);k+=l.length;if(4294967295===f.uncompressedSize||4294967295===f.compressedSize||4294967295===f.relativeOffsetOfLocalHeader){l=f.extraFields.find(t=>1===t.id);if(!l)throw Error("expected zip64 extended information extra field");l=l.data;n=0;if(4294967295===f.uncompressedSize){if(n+8> | ||
l.length)throw Error("zip64 extended information extra field does not include uncompressed size");f.uncompressedSize=F(l,n);n+=8}if(4294967295===f.compressedSize){if(n+8>l.length)throw Error("zip64 extended information extra field does not include compressed size");f.compressedSize=F(l,n);n+=8}if(4294967295===f.relativeOffsetOfLocalHeader){if(n+8>l.length)throw Error("zip64 extended information extra field does not include relative header offset");f.relativeOffsetOfLocalHeader=F(l,n);n+=8}}if(l=f.extraFields.find(t=> | ||
@@ -31,3 +31,3 @@ 28789===t.id&&6<=t.data.length&&1===t.data[0]&&w(t.data,1),ya.unsigned(f.nameBytes)))f.fileName=M(l.data.slice(5));if(0===f.compressionMethod&&(l=f.uncompressedSize,0!==(f.generalPurposeBitFlag&1)&&(l+=12),f.compressedSize!==l))throw Error(`compressed size mismatch for stored file: ${f.compressedSize} != ${l}`);c.push(f)}return{zip:{comment:d,commentBytes:h},entries:c.map(A=>new za(a,A))}}async function ia(a,b){if(b.generalPurposeBitFlag&1)throw Error("encrypted entries not supported");var c=await H(a, | ||
},addEventListener(a,b){a.addEventListener("message",b)},async terminate(a){a.terminate()}}}();class za{constructor(a,b){this._reader=a;this._rawEntry=b;this.name=b.name;this.nameBytes=b.nameBytes;this.size=b.uncompressedSize;this.compressedSize=b.compressedSize;this.comment=b.comment;this.commentBytes=b.commentBytes;this.compressionMethod=b.compressionMethod;a=b.lastModFileDate;var c=b.lastModFileTime;this.lastModDate=new Date((a>>9&127)+1980,(a>>5&15)-1,a&31,c>>11&31,c>>5&63,2*(c&31),0);this.isDirectory= | ||
0===b.uncompressedSize&&b.name.endsWith("/");this.encrypted=!!(b.generalPurposeBitFlag&1)}async blob(a="application/octet-stream"){return await Ba(this._reader,this._rawEntry,a)}async arrayBuffer(){return await Aa(this._reader,this._rawEntry)}async text(){const a=await this.arrayBuffer();return M(new Uint8Array(a))}async json(){const a=await this.text();return JSON.parse(a)}}const ya={unsigned(){return 0}},va=new TextDecoder;z.HTTPRangeReader=Da;z.cleanup=function(){ua()};z.setOptions=function(a){y.workerURL= | ||
a.workerURL||y.workerURL;a.workerURL&&(y.useWorkers=!0);y.useWorkers=void 0!==a.useWorkers?a.useWorkers:y.useWorkers;y.numWorkers=a.numWorkers||y.numWorkers};z.unzip=async function(a){const {zip:b,entries:c}=await ja(a);return{zip:b,entries:Object.fromEntries(c.map(e=>[e.name,e]))}};z.unzipRaw=ja;Object.defineProperty(z,"__esModule",{value:!0})}); | ||
0===b.uncompressedSize&&b.name.endsWith("/");this.encrypted=!!(b.generalPurposeBitFlag&1);this.externalFileAttributes=b.externalFileAttributes;this.versionMadeBy=b.versionMadeBy}async blob(a="application/octet-stream"){return await Ba(this._reader,this._rawEntry,a)}async arrayBuffer(){return await Aa(this._reader,this._rawEntry)}async text(){const a=await this.arrayBuffer();return M(new Uint8Array(a))}async json(){const a=await this.text();return JSON.parse(a)}}const ya={unsigned(){return 0}},va= | ||
new TextDecoder;z.HTTPRangeReader=Da;z.cleanup=function(){ua()};z.setOptions=function(a){y.workerURL=a.workerURL||y.workerURL;a.workerURL&&(y.useWorkers=!0);y.useWorkers=void 0!==a.useWorkers?a.useWorkers:y.useWorkers;y.numWorkers=a.numWorkers||y.numWorkers};z.unzip=async function(a){const {zip:b,entries:c}=await ja(a);return{zip:b,entries:Object.fromEntries(c.map(e=>[e.name,e]))}};z.unzipRaw=ja;Object.defineProperty(z,"__esModule",{value:!0})}); |
@@ -33,2 +33,4 @@ export type ZipInfo = { | ||
encrypted: boolean, // True if encrypted | ||
externalFileAttributes: number, // platform specific file attributes | ||
versionMadeBy: number, // platform that made this file | ||
}; | ||
@@ -35,0 +37,0 @@ |
@@ -1,2 +0,2 @@ | ||
/* unzipit@1.3.6, license MIT */ | ||
/* unzipit@1.4.0, license MIT */ | ||
/* global SharedArrayBuffer, process */ | ||
@@ -692,2 +692,4 @@ | ||
this.encrypted = !!(rawEntry.generalPurposeBitFlag & 0x1); | ||
this.externalFileAttributes = rawEntry.externalFileAttributes; | ||
this.versionMadeBy = rawEntry.versionMadeBy; | ||
} | ||
@@ -976,3 +978,3 @@ // returns a promise that returns a Blob for this entry | ||
if (!zip64ExtraField) { | ||
return new Error('expected zip64 extended information extra field'); | ||
throw new Error('expected zip64 extended information extra field'); | ||
} | ||
@@ -979,0 +981,0 @@ const zip64EiefBuffer = zip64ExtraField.data; |
{ | ||
"name": "unzipit", | ||
"version": "1.3.6", | ||
"version": "1.4.0", | ||
"description": "random access unzip library for JavaScript", | ||
@@ -17,3 +17,5 @@ "main": "dist/unzipit.js", | ||
"eslint": "eslint src/**/*.js test/tests/**/*.js", | ||
"test": "mocha test/node-test.js && node test/puppeteer.js" | ||
"test": "npm run test-node && npm run test-browser", | ||
"test-node": "mocha test/node-test.js", | ||
"test-browser": "node test/puppeteer.js" | ||
}, | ||
@@ -49,3 +51,3 @@ "files": [ | ||
"mocha": "^8.1.3", | ||
"puppeteer": "^5.3.0", | ||
"puppeteer": "^13.0.1", | ||
"rollup": "^2.27.1", | ||
@@ -52,0 +54,0 @@ "rollup-plugin-node-resolve": "^5.2.0", |
@@ -364,2 +364,4 @@ # unzipit.js | ||
encrypted: bool, // True if encrypted | ||
externalFileAttributes: number, // platform specific file attributes | ||
versionMadeBy: number, // platform that made this file | ||
} | ||
@@ -479,2 +481,7 @@ ``` | ||
## Other Limitations | ||
unzipit only supports the uncompressed and deflate compression algorithms. Other algorithms are defined | ||
in the zip spec but are uncommon. | ||
# Testing | ||
@@ -481,0 +488,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164397
3051
516