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.
@@ -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": "1.4.3",
3
+ "version": "2.0.1",
4
4
  "description": "random access unzip library for JavaScript",
5
- "main": "dist/unzipit.js",
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": ">=12"
10
+ "node": ">=18"
10
11
  },
11
12
  "scripts": {
12
- "build": "npm run build-min && npm run build-ts",
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-min": "rollup -c && google-closure-compiler --warning_level=VERBOSE --jscomp_off=globalThis --jscomp_off=checkTypes --externs build/externs.js --language_in=ECMASCRIPT_2019 --language_out=ECMASCRIPT_2019 --js dist/unzipit.js --js_output_file dist/unzipit.min.js && google-closure-compiler --warning_level=VERBOSE --jscomp_off=globalThis --jscomp_off=checkTypes --externs build/externs.js --language_in=ECMASCRIPT_2019 --language_out=ECMASCRIPT_2019 --js dist/unzipit-worker.js --js_output_file dist/unzipit-worker.min.js && node ./build/append-banner.js dist/unzipit.min.js dist/unzipit-worker.min.js",
15
- "build-ts": "node ./build/copy.js dist/unzipit.d.ts dist/unzipit.module.d.ts && tsc --lib es2019,dom,dom.iterable --target es2019 test/ts/ts-test.ts",
16
- "eslint": "eslint src/**/*.js test/tests/**/*.js",
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
- "@types/chai": "^4.2.12",
40
- "@types/mocha": "^8.0.3",
41
- "chai": "^4.2.0",
42
- "eslint": "^7.9.0",
43
- "eslint-plugin-html": "^6.1.0",
44
- "eslint-plugin-one-variable-per-var": "0.0.3",
45
- "eslint-plugin-optional-comma-spacing": "0.0.4",
46
- "eslint-plugin-require-trailing-comma": "0.0.1",
47
- "express": "^4.17.1",
48
- "google-closure-compiler": "^20200830.0.0",
49
- "mocha": "^8.1.3",
50
- "puppeteer": "^13.0.1",
51
- "rollup": "^2.27.1",
52
- "rollup-plugin-node-resolve": "^5.2.0",
53
- "typescript": "^4.0.2"
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
  }
@@ -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;