Comparing version 0.1.4 to 0.1.5
@@ -1,2 +0,2 @@ | ||
/* unzipit@0.1.4, license MIT */ | ||
/* unzipit@0.1.5, license MIT */ | ||
(function (factory) { | ||
@@ -3,0 +3,0 @@ typeof define === 'function' && define.amd ? define(factory) : |
@@ -1,2 +0,2 @@ | ||
/* unzipit@0.1.4, license MIT */ | ||
/* unzipit@0.1.5, license MIT */ | ||
function deflateRaw(data, out, opos, lvl) { | ||
@@ -3,0 +3,0 @@ var opts = [ |
@@ -1,2 +0,2 @@ | ||
/* unzipit@0.1.4, license MIT */ | ||
/* unzipit@0.1.5, license MIT */ | ||
(function (global, factory) { | ||
@@ -660,4 +660,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
function handleResult(e) { | ||
availableWorkers.push(e.target); | ||
processWaitingForWorkerQueue(); | ||
makeWorkerAvailable(e.target); | ||
const {id, error, data} = e.data; | ||
@@ -728,2 +727,7 @@ const request = currentlyProcessingIdToRequestMap.get(id); | ||
function makeWorkerAvailable(worker) { | ||
availableWorkers.push(worker); | ||
processWaitingForWorkerQueue(); | ||
} | ||
async function getAvailableWorker() { | ||
@@ -763,2 +767,7 @@ if (availableWorkers.length === 0 && numWorkers < config.numWorkers) { | ||
if (worker) { | ||
if (waitingForWorkerQueue.length === 0) { | ||
// the queue might be empty while we awaited for a worker. | ||
makeWorkerAvailable(worker); | ||
return; | ||
} | ||
const {id, src, uncompressedSize, type, resolve, reject} = waitingForWorkerQueue.shift(); | ||
@@ -765,0 +774,0 @@ currentlyProcessingIdToRequestMap.set(id, {id, resolve, reject}); |
@@ -1,2 +0,2 @@ | ||
/* unzipit@0.1.4, license MIT */ | ||
/* unzipit@0.1.5, license MIT */ | ||
/* global SharedArrayBuffer, process */ | ||
@@ -654,4 +654,3 @@ | ||
function handleResult(e) { | ||
availableWorkers.push(e.target); | ||
processWaitingForWorkerQueue(); | ||
makeWorkerAvailable(e.target); | ||
const {id, error, data} = e.data; | ||
@@ -722,2 +721,7 @@ const request = currentlyProcessingIdToRequestMap.get(id); | ||
function makeWorkerAvailable(worker) { | ||
availableWorkers.push(worker); | ||
processWaitingForWorkerQueue(); | ||
} | ||
async function getAvailableWorker() { | ||
@@ -757,2 +761,7 @@ if (availableWorkers.length === 0 && numWorkers < config.numWorkers) { | ||
if (worker) { | ||
if (waitingForWorkerQueue.length === 0) { | ||
// the queue might be empty while we awaited for a worker. | ||
makeWorkerAvailable(worker); | ||
return; | ||
} | ||
const {id, src, uncompressedSize, type, resolve, reject} = waitingForWorkerQueue.shift(); | ||
@@ -759,0 +768,0 @@ currentlyProcessingIdToRequestMap.set(id, {id, resolve, reject}); |
{ | ||
"name": "unzipit", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "random access unzip library for JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/unzipit.js", |
# unzipit.js | ||
<img src="./unzipit-no-anim.svg" style="max-width: 640px"> | ||
Random access unzip library for browser and node based JavaScript | ||
@@ -189,7 +191,5 @@ | ||
const {entries} = await unzip(url); | ||
for (const entry of Object.values(entries)) { | ||
if (!entry.isDirectory) { | ||
const data = await entry.arrayBuffer(); | ||
} | ||
} | ||
await Promise.all(Object.values(entries).map(async(entry) => { | ||
entry.data = await entry.arrayBuffer(); | ||
})); | ||
} | ||
@@ -277,3 +277,3 @@ ``` | ||
```js | ||
import { unzipit, unzipitRaw, setOptions } from 'unzipit'; | ||
import { unzipit, unzipitRaw, setOptions, cleanup } from 'unzipit'; | ||
``` | ||
@@ -319,3 +319,3 @@ | ||
* `useWorkers`: true/false | ||
* `useWorkers`: true/false (default: false) | ||
@@ -326,6 +326,11 @@ * `workerURL`: string | ||
* `numWorkers`: number (default 1) | ||
* `numWorkers`: number (default: 1) | ||
How many workers to use. You can inflate more files in parallel with more workers. | ||
## cleanup | ||
Shuts down the workers. You would only need to call this if you want node | ||
to exit since it will wait for the workers to exit | ||
# Notes: | ||
@@ -338,4 +343,2 @@ | ||
## SharedArrayBuffer | ||
## Streaming | ||
@@ -342,0 +345,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
164257
3621
436