Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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-repo

npm 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#branch

const 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 succeeded

const 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)