1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-06 02:39:55 +02:00

Updat TS types

This commit is contained in:
Jeff Schiller 2024-01-26 09:25:10 -08:00
parent b00dc80946
commit 08a0fd8e6c
17 changed files with 69 additions and 40 deletions

View file

@ -1,12 +1,18 @@
/**
* common.js
*
* Provides common functionality for compressing and decompressing.
* Provides common definitions or functionality needed by multiple modules.
*
* Licensed under the MIT License
*
* Copyright(c) 2023 Google Inc.
*/
/**
* @typedef FileInfo An object that is sent to the implementation representing a file to compress.
* @property {string} fileName The name of the file. TODO: Includes the path?
* @property {number} lastModTime The number of ms since the Unix epoch (1970-01-01 at midnight).
* @property {Uint8Array} fileData The bytes of the file.
*/
/**
* @typedef Implementation
* @property {MessagePort} hostPort The port the host uses to communicate with the implementation.
@ -24,6 +30,36 @@
* MessagePort connected to the implementation that the host should use.
*/
export function getConnectedPort(implFilename: string): Promise<Implementation>;
export const LOCAL_FILE_HEADER_SIG: 67324752;
export const CENTRAL_FILE_HEADER_SIG: 33639248;
export const END_OF_CENTRAL_DIR_SIG: 101010256;
export const CRC32_MAGIC_NUMBER: 3988292384;
export const ARCHIVE_EXTRA_DATA_SIG: 134630224;
export const DIGITAL_SIGNATURE_SIG: 84233040;
export const END_OF_CENTRAL_DIR_LOCATOR_SIG: 117853008;
export const DATA_DESCRIPTOR_SIG: 134695760;
export type ZipCompressionMethod = number;
export namespace ZipCompressionMethod {
const STORE: number;
const DEFLATE: number;
}
/**
* An object that is sent to the implementation representing a file to compress.
*/
export type FileInfo = {
/**
* The name of the file. TODO: Includes the path?
*/
fileName: string;
/**
* The number of ms since the Unix epoch (1970-01-01 at midnight).
*/
lastModTime: number;
/**
* The bytes of the file.
*/
fileData: Uint8Array;
};
export type Implementation = {
/**
* The port the host uses to communicate with the implementation.