UNPKG

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