Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unzipit

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unzipit - npm Package Compare versions

Comparing version 1.4.2 to 1.4.3

2

dist/unzipit-worker.js

@@ -1,2 +0,2 @@

/* unzipit@1.4.2, license MIT */
/* unzipit@1.4.3, license MIT */
(function (factory) {

@@ -3,0 +3,0 @@ typeof define === 'function' && define.amd ? define(factory) :

@@ -1,2 +0,2 @@

/* unzipit@1.4.2, license MIT */
/* unzipit@1.4.3, 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.4.2, license MIT */
/* unzipit@1.4.3, license MIT */
function inflate(data, buf) {

@@ -3,0 +3,0 @@ var u8=Uint8Array;

@@ -50,4 +50,6 @@ export type ZipInfo = {

export class HTTPRangeReader {
constructor(url: string);
export class HTTPRangeReader implements Reader {
constructor(url: string);
getLength(): Promise<number>;
read(offset: number, size: number): Promise<Uint8Array>;
}

@@ -54,0 +56,0 @@

@@ -1,2 +0,2 @@

/* unzipit@1.4.2, license MIT */
/* unzipit@1.4.3, license MIT */
(function (global, factory) {

@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :

@@ -1,2 +0,2 @@

/* unzipit@1.4.2, license MIT */
/* unzipit@1.4.3, 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)}

@@ -3,0 +3,0 @@ 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}

@@ -50,4 +50,6 @@ export type ZipInfo = {

export class HTTPRangeReader {
constructor(url: string);
export class HTTPRangeReader implements Reader {
constructor(url: string);
getLength(): Promise<number>;
read(offset: number, size: number): Promise<Uint8Array>;
}

@@ -54,0 +56,0 @@

@@ -1,2 +0,2 @@

/* unzipit@1.4.2, license MIT */
/* unzipit@1.4.3, license MIT */
/* global SharedArrayBuffer, process */

@@ -3,0 +3,0 @@

{
"name": "unzipit",
"version": "1.4.2",
"version": "1.4.3",
"description": "random access unzip library for JavaScript",

@@ -5,0 +5,0 @@ "main": "dist/unzipit.js",

@@ -18,2 +18,3 @@ # unzipit.js

Live Example: [https://jsfiddle.net/greggman/awez4sd7/](https://jsfiddle.net/greggman/awez4sd7/)
Live Parallel Example: [https://jsfiddle.net/greggman/cgdjm07f/](https://jsfiddle.net/greggman/cgdjm07f/)

@@ -67,2 +68,19 @@ ## without workers

## In Parallel
```js
import {unzip, setOptions} from 'unzipit';
setOptions({workerURL: 'path/to/unzipit-worker.module.js'});
async function readFiles(url) {
const {entries} = await unzipit.unzip(url);
const names = Object.keys(entries);
const blobs = await Promise.all(Object.values(entries).map(e => e.blob()));
// names and blobs are now parallel arrays so do whatever you want.
const blobsByName = Object.fromEntries(names.map((name, i) => [name, blobs[i]]));
}
```
You can also pass a [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob),

@@ -481,2 +499,17 @@ [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer),

## Filename issues in general.
unzipit doesn't and can't know if a filename is valid for your use case. A zip file
can have any name with any characters in the filename data. All unzipit can do is give you
the filename as a string from the zip file. It's up to you do deal with it, for example
to strip out or replace characters in the filename that are incompatible with your OS.
For example [this zip file](https://github.com/greggman/unzipit/files/10998616/problem-filenames.zip)
has these filenames: `'this#file\\name%is&iffy'`, `'???And This one???'`, `'fo:oo'` which
I believe are problematic on Windows. A user found a file with double slashes as in `foo//bar`
so you'll need to decide what to do with that.
There is also the issue a user could make a malicious filename. For example "../../.bash_profile"
on the hope that some program doesn't check the names and just uses the paths as is.
If you're going to use unzipit to create files you should check and sanitize your paths.
## ArrayBuffer and SharedArrayBuffer caveats

@@ -483,0 +516,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc