Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit 404eaa3

Browse files
committed
docs: improve current API
1 parent ce3e6b4 commit 404eaa3

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

README.md

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@ $ yarn add @nodesecure/gitlab
2929
import * as gitlab from "@nodesecure/gitlab";
3030

3131
// 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);
3436
```
3537

3638
## API
3739

40+
Both `download` and `downloadAndExtract` functions use the same set of options.
41+
3842
```ts
39-
export interface DownloadOptions {
43+
interface DownloadOptions {
4044
/**
4145
* The destination (location) to extract the tar.gz
4246
*
@@ -61,8 +65,13 @@ export interface DownloadOptions {
6165
*/
6266
gitlab?: string;
6367
}
68+
```
6469

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 {
6675
/** Archive or repository location on disk */
6776
location: string;
6877
/** Gitlab repository name */
@@ -72,35 +81,20 @@ export interface DownloadResult {
7281
/** Gitlab branch name */
7382
branch: string;
7483
}
84+
```
7585

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.
8088

81-
export interface DownloadExtractOptions extends DownloadOptions {
89+
```ts
90+
interface DownloadExtractOptions extends DownloadOptions {
8291
/**
8392
* Remove the tar.gz archive after a succesfull extraction
8493
*
8594
* @default true
8695
*/
8796
removeArchive?: boolean;
8897
}
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("...");
10498
```
10599

106100
## Contributors ✨

0 commit comments

Comments
 (0)