@snailuu/git-down
Version:
37 lines (33 loc) • 1.01 kB
text/typescript
interface GitDownOption {
/** 输出路径 */
output?: string;
/** 下载的分支 */
branch?: string;
}
interface GitUrlInfo {
href: string;
/** 是否是仓库链接 */
isRepo: boolean;
/** 仓库拥有者 */
owner: string;
/** 仓库名称 */
project: string;
/** 分支 */
branch: string;
/** 文件路径 */
pathname: string;
/** 资源类型 */
sourceType: 'file' | 'dir';
}
declare function parseGitUrl(url: string): GitUrlInfo;
/**
* 下载 github 仓库或文件
*/
declare function gitDownWithCallback(path: string, option?: GitDownOption, callback?: (error: Error | null) => void): void;
/**
* 下载 github 仓库或文件
*
* @warning 下载过程中会频繁修改执行目录, 请勿在运行期间执行文件相关操作, 除非你清楚执行目录的修改行为
*/
declare function gitDown(path: string, option?: GitDownOption): Promise<void>;
export { gitDown as default, gitDown, gitDownWithCallback, parseGitUrl };