Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vtrbo/load-repo
⚙ Victor Bo's Download Git Repository.
https://github.com/vtrbo/load-repo
download git-repo
Last synced: 20 days ago
JSON representation
⚙ Victor Bo's Download Git Repository.
- Host: GitHub
- URL: https://github.com/vtrbo/load-repo
- Owner: vtrbo
- License: mit
- Created: 2022-08-05T03:20:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-20T12:37:27.000Z (over 2 years ago)
- Last Synced: 2024-12-04T02:16:34.294Z (about 1 month ago)
- Topics: download, git-repo
- Language: TypeScript
- Homepage:
- Size: 59.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# load-repo [![npm](https://img.shields.io/npm/v/load-repo?color=a1b858&label=)](https://npmjs.com/package/load-repo)
> You need to make sure `git` is in your path, otherwise you can move on
> This is a library based on [git-clone](https://www.npmjs.com/package/git-clone) development### Install
```bash
load-reponpm install load-repo
```### Api
> `loadRepo(repo: string): void`> `loadRepo(repo: string, path?: string): void`
> `loadRepo(repo: string, path?: string, options?: IOptions): void`
> `loadRepo(repo: string, path?: string, callback?: (error?: Error) => void): void`
> `loadRepo(repo: string, path?: string, options?: IOptions, callback?: (error?: Error) => void): void`
repo
```ts
// rule: origin:owner/name#branchconst repo = 'github:vtrbo/load-repo#main'
```
path
```ts
// default value process.cwd()const path = '/'
```
options
```ts
/**
* IOptions
* {
* if clone is true, keep .git; otherwise, delete it
* clone: boolean
*
* if branch is undefined, Clone the default branch
* branch: string
* }
*/const options = {
clone: true,
branch: 'main'
}
```
callback
```ts
// if error exists, it means that the download failed; otherwise, it succeededconst callback = (error: Error) => {
if (error)
console.log('download fail')
else
console.log('download success')
}
```## 开源许可证
[MIT](./LICENSE) License © 2022-PRESENT [Victor Bo](https://github.com/vtrbo)