Skip to content

Commit 08a0fd8

Browse files
committed
Updat TS types
1 parent b00dc80 commit 08a0fd8

17 files changed

+69
-40
lines changed

types/archive/common.d.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
/**
22
* common.js
33
*
4-
* Provides common functionality for compressing and decompressing.
4+
* Provides common definitions or functionality needed by multiple modules.
55
*
66
* Licensed under the MIT License
77
*
88
* Copyright(c) 2023 Google Inc.
99
*/
10+
/**
11+
* @typedef FileInfo An object that is sent to the implementation representing a file to compress.
12+
* @property {string} fileName The name of the file. TODO: Includes the path?
13+
* @property {number} lastModTime The number of ms since the Unix epoch (1970-01-01 at midnight).
14+
* @property {Uint8Array} fileData The bytes of the file.
15+
*/
1016
/**
1117
* @typedef Implementation
1218
* @property {MessagePort} hostPort The port the host uses to communicate with the implementation.
@@ -24,6 +30,36 @@
2430
* MessagePort connected to the implementation that the host should use.
2531
*/
2632
export function getConnectedPort(implFilename: string): Promise<Implementation>;
33+
export const LOCAL_FILE_HEADER_SIG: 67324752;
34+
export const CENTRAL_FILE_HEADER_SIG: 33639248;
35+
export const END_OF_CENTRAL_DIR_SIG: 101010256;
36+
export const CRC32_MAGIC_NUMBER: 3988292384;
37+
export const ARCHIVE_EXTRA_DATA_SIG: 134630224;
38+
export const DIGITAL_SIGNATURE_SIG: 84233040;
39+
export const END_OF_CENTRAL_DIR_LOCATOR_SIG: 117853008;
40+
export const DATA_DESCRIPTOR_SIG: 134695760;
41+
export type ZipCompressionMethod = number;
42+
export namespace ZipCompressionMethod {
43+
const STORE: number;
44+
const DEFLATE: number;
45+
}
46+
/**
47+
* An object that is sent to the implementation representing a file to compress.
48+
*/
49+
export type FileInfo = {
50+
/**
51+
* The name of the file. TODO: Includes the path?
52+
*/
53+
fileName: string;
54+
/**
55+
* The number of ms since the Unix epoch (1970-01-01 at midnight).
56+
*/
57+
lastModTime: number;
58+
/**
59+
* The bytes of the file.
60+
*/
61+
fileData: Uint8Array;
62+
};
2763
export type Implementation = {
2864
/**
2965
* The port the host uses to communicate with the implementation.

types/archive/common.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/archive/decompress.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/archive/events.d.ts

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@ export namespace UnarchiveEventType {
77
const INFO: string;
88
const ERROR: string;
99
}
10-
/**
11-
* An unarchive event.
12-
*/
10+
/** An unarchive event. */
1311
export class UnarchiveEvent extends Event {
1412
/**
1513
* @param {string} type The event type.
1614
*/
1715
constructor(type: string);
1816
}
19-
/**
20-
* Updates all Archiver listeners that an append has occurred.
21-
*/
17+
/** Updates all Unarchiver listeners that an append has occurred. */
2218
export class UnarchiveAppendEvent extends UnarchiveEvent {
2319
/**
2420
* @param {number} numBytes The number of bytes appended.
@@ -30,45 +26,35 @@ export class UnarchiveAppendEvent extends UnarchiveEvent {
3026
*/
3127
numBytes: number;
3228
}
33-
/**
34-
* Useful for passing info up to the client (for debugging).
35-
*/
29+
/** Useful for passing info up to the client (for debugging). */
3630
export class UnarchiveInfoEvent extends UnarchiveEvent {
3731
/**
3832
* The information message.
3933
* @type {string}
4034
*/
4135
msg: string;
4236
}
43-
/**
44-
* An unrecoverable error has occured.
45-
*/
37+
/** An unrecoverable error has occured. */
4638
export class UnarchiveErrorEvent extends UnarchiveEvent {
4739
/**
4840
* The information message.
4941
* @type {string}
5042
*/
5143
msg: string;
5244
}
53-
/**
54-
* Start event.
55-
*/
45+
/** Start event. */
5646
export class UnarchiveStartEvent extends UnarchiveEvent {
5747
constructor();
5848
}
59-
/**
60-
* Finish event.
61-
*/
49+
/** Finish event. */
6250
export class UnarchiveFinishEvent extends UnarchiveEvent {
6351
/**
6452
* @param {Object} metadata A collection fo metadata about the archive file.
6553
*/
6654
constructor(metadata?: any);
6755
metadata: any;
6856
}
69-
/**
70-
* Progress event.
71-
*/
57+
/** Progress event. */
7258
export class UnarchiveProgressEvent extends UnarchiveEvent {
7359
/**
7460
* @param {string} currentFilename
@@ -88,9 +74,7 @@ export class UnarchiveProgressEvent extends UnarchiveEvent {
8874
totalUncompressedBytesInArchive: number;
8975
totalCompressedBytesRead: number;
9076
}
91-
/**
92-
* Extract event.
93-
*/
77+
/** Extract event. */
9478
export class UnarchiveExtractEvent extends UnarchiveEvent {
9579
/**
9680
* @param {UnarchivedFile} unarchivedFile

types/archive/events.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/file/sniffer.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/image/parsers/parsers.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @template T
44
* @param {string} type The event type.
55
* @param {T} data The event data.
6-
* @return {CustomEvent<T>} The new event.
6+
* @returns {CustomEvent<T>} The new event.
77
*/
88
export function createEvent<T>(type: string, data: T): CustomEvent<T>;
99
//# sourceMappingURL=parsers.d.ts.map

types/image/parsers/png.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ export class PngParser extends EventTarget {
170170
onSuggestedPalette(listener: (arg0: CustomEvent<PngSuggestedPalette>) => void): PngParser;
171171
/**
172172
* Type-safe way to bind a listener for a PngTextualData.
173-
* @param {function(PngTextualData): void} listener
173+
* @param {function(CustomEvent<PngTextualData>): void} listener
174174
* @returns {PngParser} for chaining
175175
*/
176-
onTextualData(listener: (arg0: PngTextualData) => void): PngParser;
176+
onTextualData(listener: (arg0: CustomEvent<PngTextualData>) => void): PngParser;
177177
/**
178178
* Type-safe way to bind a listener for a PngTransparency.
179179
* @param {function(CustomEvent<PngTransparency>): void} listener

types/image/parsers/png.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/image/webp-shim/webp-shim.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)