@@ -29,14 +29,18 @@ $ yarn add @nodesecure/gitlab
29
29
import * as gitlab from " @nodesecure/gitlab" ;
30
30
31
31
// Note: repository can be either namespace path or repository ID
32
- const is = await gitlab .download (" NodeSecure.utils" );
33
- console .log (is .location );
32
+ const result = await gitlab .download (
33
+ " NodeSecure.utils"
34
+ );
35
+ console .log (result);
34
36
```
35
37
36
38
## API
37
39
40
+ Both ` download ` and ` downloadAndExtract ` functions use the same set of options.
41
+
38
42
``` ts
39
- export interface DownloadOptions {
43
+ interface DownloadOptions {
40
44
/**
41
45
* The destination (location) to extract the tar.gz
42
46
*
@@ -61,8 +65,13 @@ export interface DownloadOptions {
61
65
*/
62
66
gitlab? : string ;
63
67
}
68
+ ```
64
69
65
- export interface DownloadResult {
70
+ ### download(repository: string, options?: DownloadOptions): Promise< DownloadResult >
71
+ Download the tar.gz archive of the GIT repository.
72
+
73
+ ``` ts
74
+ interface DownloadResult {
66
75
/** Archive or repository location on disk */
67
76
location: string ;
68
77
/** Gitlab repository name */
@@ -72,35 +81,20 @@ export interface DownloadResult {
72
81
/** Gitlab branch name */
73
82
branch: string ;
74
83
}
84
+ ```
75
85
76
- export function download(
77
- repo : string ,
78
- options ? : DownloadOptions
79
- ): Promise <DownloadResult >;
86
+ ### downloadAndExtract(repository: string, options?: DownloadExtractOptions): Promise< DownloadResult >
87
+ Use download but extract the tar.gz archive.
80
88
81
- export interface DownloadExtractOptions extends DownloadOptions {
89
+ ``` ts
90
+ interface DownloadExtractOptions extends DownloadOptions {
82
91
/**
83
92
* Remove the tar.gz archive after a succesfull extraction
84
93
*
85
94
* @default true
86
95
*/
87
96
removeArchive? : boolean ;
88
97
}
89
-
90
- export function downloadAndExtract(
91
- repo : string ,
92
- options ? : DownloadExtractOptions
93
- ): Promise <DownloadResult >;
94
- ```
95
-
96
- ### Custom gitlab URL
97
-
98
- To work with a custom gitlab instance you can either setup a ` GITLAB_URL ` system variable or use ` setUrl ` method:
99
-
100
- ``` js
101
- import * as gitlab from " @nodesecure/gitlab" ;
102
-
103
- gitlab .setUrl (" ..." );
104
98
```
105
99
106
100
## Contributors ✨
0 commit comments