UNPKG

@dscodotco/theme-cli

Version:

A CLI tool for developing Shopify themes

25 lines (24 loc) 794 B
/** * @module utils/zip * @description Utilities for working with zip files */ /** * Extracts a zip file to a specified directory * * @param zipBuffer - The zip file as a buffer * @param targetDir - The directory to extract to * @param stripFirstDir - Whether to strip the first directory level from the zip * * @example * ```typescript * // Extract a zip file * const zipData = await downloadFile('https://example.com/file.zip'); * extractZip(Buffer.from(zipData), './target-dir'); * * // Extract a zip file and strip the first directory level * extractZip(Buffer.from(zipData), './target-dir', true); * ``` * * @throws Will throw an error if the extraction fails */ export declare function extractZip(zipBuffer: Buffer, targetDir: string, stripFirstDir?: boolean): void;