UNPKG

1.73 kBMarkdownView Raw
1# download-git-repo
2
3Download and extract a git repository (GitHub, GitLab, Bitbucket) from node.
4
5## Installation
6
7 $ npm install download-git-repo
8
9## API
10
11### download(repository, destination, options, callback)
12
13Download a git `repository` to a `destination` folder with `options`, and `callback`.
14
15#### repository
16The short hand repository string to download the repository from.
17
18- GitHub - `github:owner/name` or simply `owner/name`
19- GitLab - `gitlab:owner/name`
20- Bitbucket - `bitbucket:owner/name`
21
22The `repository` parameter defaults to the `master` branch, but you can specify a branch or tag as a URL fragment like `owner/name#my-branch`.
23Feel free to submit an issue or pull request for additional host options.
24
25#### destination
26The file path to download the repository to.
27
28#### options
29An optional options object parameter with download options. Options include:
30
31- `clone` - boolean default `false` - If true use `git clone` instead of an http download. While this can be a bit slower, it does allow private repositories to be used if the appropriate SSH keys are setup.
32
33#### callback
34The callback function as `function(err)`.
35
36## Examples
37Using http download from Github repository at master.
38```javascript
39download('zeke/download-github-repo-fixture', 'test/tmp', function(err) {
40 if (err) return done(err);
41 done();
42});
43```
44
45Using git clone from Bitbucket repository at my-branch.
46```javascript
47download('bitbucket:flipxfx/download-bitbucket-repo-fixture#my-branch', 'test/tmp', { clone: true }, function(err) {
48 if (err) return done(err);
49 done();
50});
51```
52
53## Thanks
54
55To [ianstormtaylor/download-github-repo](https://github.com/ianstormtaylor/download-github-repo) for the head start.
56
57## License
58
59MIT
60