unzipit 1.4.3 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -5
- package/dist/ArrayBufferReader.d.ts +7 -0
- package/dist/BlobReader.d.ts +12 -0
- package/dist/HTTPRangeReader.d.ts +8 -0
- package/dist/inflate-worker.d.ts +1 -0
- package/dist/inflate.d.ts +8 -0
- package/dist/unzipit-worker.js +92 -355
- package/dist/unzipit-worker.min.js +1 -12
- package/dist/unzipit-worker.module.js +90 -353
- package/dist/unzipit.d.ts +71 -56
- package/dist/unzipit.js +734 -1031
- package/dist/unzipit.min.js +1 -31
- package/dist/unzipit.module.js +728 -1026
- package/dist/utils.d.ts +6 -0
- package/package.json +26 -25
- package/dist/unzipit.module.d.ts +0 -59
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function readBlobAsArrayBuffer(blob: Blob): Promise<ArrayBuffer>;
|
|
2
|
+
export declare function readBlobAsUint8Array(blob: Blob): Promise<Uint8Array<ArrayBuffer>>;
|
|
3
|
+
export declare function isBlob(v: unknown): v is Blob;
|
|
4
|
+
export declare function isSharedArrayBuffer(b: unknown): b is SharedArrayBuffer;
|
|
5
|
+
export declare const isNode: boolean;
|
|
6
|
+
export declare function isTypedArraySameAsArrayBuffer(typedArray: Uint8Array): boolean;
|
package/package.json
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unzipit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "random access unzip library for JavaScript",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/unzipit.module.js",
|
|
6
7
|
"module": "dist/unzipit.module.js",
|
|
7
8
|
"types": "dist/unzipit.d.ts",
|
|
8
9
|
"engines": {
|
|
9
|
-
"node": ">=
|
|
10
|
+
"node": ">=18"
|
|
10
11
|
},
|
|
11
12
|
"scripts": {
|
|
12
|
-
"build": "npm run build-
|
|
13
|
+
"build": "npm run build-js && npm run build-types && npm run build-ts-test && node build/copy.js node_modules/chai/index.js test/chai.js && node build/copy.js node_modules/mocha/mocha.js test/mocha.js && node build/copy.js node_modules/mocha/mocha.css test/mocha.css",
|
|
14
|
+
"build-ci": "npm run build && node build/prep-for-deploy.js",
|
|
13
15
|
"build-normal": "rollup -c",
|
|
14
|
-
"build-
|
|
15
|
-
"build-
|
|
16
|
-
"
|
|
16
|
+
"build-js": "rollup -c",
|
|
17
|
+
"build-types": "tsc -p tsconfig.build.json",
|
|
18
|
+
"build-ts-test": "rollup -c test/ts/rollup.test.config.js",
|
|
19
|
+
"eslint": "eslint src/**/*.ts test/index.js test/node-test.js test/puppeteer.js test/tests/**/*.js",
|
|
17
20
|
"test": "npm run test-node && npm run test-browser",
|
|
18
21
|
"test-node": "mocha test/node-test.js",
|
|
19
22
|
"test-browser": "node test/puppeteer.js"
|
|
@@ -36,23 +39,21 @@
|
|
|
36
39
|
},
|
|
37
40
|
"homepage": "https://greggman.github.io/unzipit",
|
|
38
41
|
"devDependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"eslint-plugin
|
|
46
|
-
"eslint
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"rollup
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
"dependencies": {
|
|
56
|
-
"uzip-module": "^1.0.2"
|
|
42
|
+
"@eslint/js": "^10.0.1",
|
|
43
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
44
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
45
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
46
|
+
"@types/chai": "^5.2.3",
|
|
47
|
+
"@types/mocha": "^10.0.10",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^8.57.2",
|
|
49
|
+
"@typescript-eslint/parser": "^8.57.2",
|
|
50
|
+
"chai": "^6.2.2",
|
|
51
|
+
"eslint": "^10.1.0",
|
|
52
|
+
"express": "^5.2.1",
|
|
53
|
+
"mocha": "^11.7.5",
|
|
54
|
+
"puppeteer": "^24.0.0",
|
|
55
|
+
"rollup": "^4.29.0",
|
|
56
|
+
"tslib": "^2.8.1",
|
|
57
|
+
"typescript": "5.9.3"
|
|
57
58
|
}
|
|
58
59
|
}
|
package/dist/unzipit.module.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export type ZipInfo = {
|
|
2
|
-
zip: Zip,
|
|
3
|
-
entries: {[key: string]: ZipEntry},
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
export type ZipInfoRaw = {
|
|
7
|
-
zip: Zip,
|
|
8
|
-
entries: ZipEntry[],
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export type Zip = {
|
|
12
|
-
comment: string, // the comment for the zip file
|
|
13
|
-
commentBytes: Uint8Array, // the raw data for comment, see nameBytes
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type ZipEntry = {
|
|
17
|
-
blob(type?: string): Promise<Blob>, // returns a Blob for this entry
|
|
18
|
-
// (optional type as in 'image/jpeg')
|
|
19
|
-
arrayBuffer(): Promise<ArrayBuffer>, // returns an ArrayBuffer for this entry
|
|
20
|
-
text(): Promise<string>, // returns text, assumes the text is valid utf8.
|
|
21
|
-
// If you want more options decode arrayBuffer yourself
|
|
22
|
-
json(): Promise<any>, // returns text with JSON.parse called on it.
|
|
23
|
-
// If you want more options decode arrayBuffer yourself
|
|
24
|
-
name: string, // name of entry
|
|
25
|
-
nameBytes: Uint8Array, // raw name of entry (see notes)
|
|
26
|
-
size: number, // size in bytes
|
|
27
|
-
compressedSize: number, // size before decompressing
|
|
28
|
-
comment: string, // the comment for this entry
|
|
29
|
-
commentBytes: Uint8Array, // the raw comment for this entry
|
|
30
|
-
lastModDate: Date, // a Date
|
|
31
|
-
isDirectory: boolean, // True if directory
|
|
32
|
-
encrypted: boolean, // True if encrypted
|
|
33
|
-
externalFileAttributes: number, // platform specific file attributes
|
|
34
|
-
versionMadeBy: number, // platform that made this file
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export interface Reader {
|
|
38
|
-
getLength(): Promise<number>,
|
|
39
|
-
read(offset: number, size: number): Promise<Uint8Array>,
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export type UnzipitOptions = {
|
|
43
|
-
useWorkers?: boolean;
|
|
44
|
-
workerURL?: string;
|
|
45
|
-
numWorkers?: number;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array;
|
|
49
|
-
|
|
50
|
-
export class HTTPRangeReader implements Reader {
|
|
51
|
-
constructor(url: string);
|
|
52
|
-
getLength(): Promise<number>;
|
|
53
|
-
read(offset: number, size: number): Promise<Uint8Array>;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function unzip(src: string | ArrayBuffer | TypedArray | Blob | Reader): Promise<ZipInfo>;
|
|
57
|
-
export function unzipRaw(src: string | ArrayBuffer | TypedArray | Blob | Reader): Promise<ZipInfoRaw>;
|
|
58
|
-
export function setOptions(options: UnzipitOptions): void;
|
|
59
|
-
export function cleanup(): void;
|