Integrate GitZip into your website
masterGitZip methods directly in your client-side code.repository·master·Indexed 20 days ago
https://github.com/kinolien/gitzipA tool and web-based API that allows users to download specific sub-folders, sub-directories, or single files of a GitHub repository as a ZIP file. Includes functionality for triggering downloads via GitZip.zipRepo() and monitoring progress through GitZip.registerCallback().
GitZip methods directly in your client-side code.You can monitor the zipping process (fetching files, zipping, errors, etc.) by registering a callback function using GitZip.registerCallback(inputFn).
The callback function receives three arguments:
status (string): The current state. Possible values include 'error', 'prepare', 'processing', and 'done'.message (string): A descriptive message corresponding to the current status.percent (number): A value from 0 to 100 representing the progress percentage (primarily for debugging).GitZip.registerCallback(function(status, message, percent) {
console.log(`[${status}] ${message} - ${percent}%`);
});Use GitZip.zipRepo() to trigger the zipping and downloading process for a GitHub repository, a specific sub-directory, or a single file. You can provide a callbackScope to control the this context of the progress callback if one is registered.
Supported URL patterns include:
https://github.com/user/repohttps://github.com/user/repo/tree/branch/folderhttps://github.com/user/repo/blob/branch/file.ext// Zip the entire repository
GitZip.zipRepo("https://github.com/KinoLien/gitzip");
// Zip a specific sub-directory
GitZip.zipRepo("https://github.com/KinoLien/gitzip/tree/master/js");
// Zip a single file
GitZip.zipRepo("https://github.com/KinoLien/gitzip/blob/master/example.html");