Motivation
Users currently leave for other libraries (e.g. react-native-zip-stream) when they need to inspect a ZIP before extracting, or extract only some entries. See e.g. SO: Read zip file content before unzipping.
Proposal
listContents(source: string, charset?: string): Promise<ZipEntry[]>
Return archive metadata without extracting:
type ZipEntry = {
path: string;
size: number; // uncompressed
compressedSize: number;
isDirectory: boolean;
isEncrypted: boolean;
};
unzipFiles(source, destination, entries: string[], charset?: string): Promise<string>
unzipFilesWithPassword(source, destination, entries: string[], password: string): Promise<string>
Extract only the listed entry paths (files and/or directories). Paths that escape the destination must be rejected (Zip Slip).
Acceptance criteria
Priority
P0
Motivation
Users currently leave for other libraries (e.g.
react-native-zip-stream) when they need to inspect a ZIP before extracting, or extract only some entries. See e.g. SO: Read zip file content before unzipping.Proposal
listContents(source: string, charset?: string): Promise<ZipEntry[]>Return archive metadata without extracting:
unzipFiles(source, destination, entries: string[], charset?: string): Promise<string>unzipFilesWithPassword(source, destination, entries: string[], password: string): Promise<string>Extract only the listed entry paths (files and/or directories). Paths that escape the destination must be rejected (Zip Slip).
Acceptance criteria
*WithPasswordvariantPriority
P0