node-hk-zip
Version:
UNZIP implementation for NodeJS
50 lines (49 loc) • 1.57 kB
TypeScript
/**
* @fileOverview Definition of ZipFile class
*/
/// <reference types="node" />
import { IZipFile } from './interfaces/ZipFile';
import { ZipEntry } from './ZipEntry';
/**
* Class representing a ZipFile
* @implements IZipFile
*/
export declare class ZipFile implements IZipFile {
private EOCDH;
private readonly data;
private readonly EOCDHoffset;
/**
* Creates a Zip File
* @param {Buffer} data - Zip binary data
* @return {ZipFile} - ZipFile object
*/
constructor(data: Buffer);
/**
* Searches a ZIP entry by given path
* @param {Array<string>} paths - List of paths to search
* @return {Array<ZipEntry>} list - The list of entries found
*/
findEntries(paths: string[]): ZipEntry[];
/**
* Lists all entries in the ZIP file
* @return {Array<ZipEntry>} list - The list of entries
*/
listAllEntries(): ZipEntry[];
/**
* Searches entries by RegExp
* @param {RegExp} regs - match list
* @return {Array<ZipEntry>} list - The list of entries
*/
findMatchingEntries(regs: RegExp[]): ZipEntry[];
/**
* Finds End of Central Directory offset
* @return {number} offset - Offset of EndOfCentralDirectory header
*/
private findEndOfCentralDirOffset;
/**
* Lists all entries in the ZIP file if param paths is empty, otherwise filters the list by given paths
* @param {Array<string>} paths - List of paths to search
* @return {Array<ZipEntry>} list - The list of entries found
*/
private listEntries;
}