/
main.d.ts
50 lines (46 loc) · 1.13 KB
/
main.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import type { Stream } from 'node:stream'
export interface Options {
/**
* Base URL.
* Can be customized (for example `https://npmmirror.com/mirrors/node`).
*
* The following environment variables can also be used: `NODE_MIRROR`,
* `NVM_NODEJS_ORG_MIRROR`, `N_NODE_MIRROR` or `NODIST_NODE_MIRROR`.
*
* @default 'https://nodejs.org/dist'
*/
mirror?: string
/**
* Show a progress bar.
*
* @default `false`
*/
progress?: boolean
/**
* Cancels the release download when the signal is aborted.
*/
signal?: AbortSignal
}
/**
* Download release files available on
* [`https://nodejs.org/dist/`](https://nodejs.org/dist/).
*
* @example
* ```js
* const stream = await fetchNodeWebsite('v12.8.0/node-v12.8.0-linux-x64.tar.gz')
*
* // Example with options
* const otherStream = await fetchNodeWebsite(
* 'v12.8.0/node-v12.8.0-linux-x64.tar.gz',
* {
* progress: true,
* mirror: 'https://npmmirror.com/mirrors/node',
* signal: new AbortController().signal,
* },
* )
* ```
*/
export default function fetchNodeWebsite(
path: string,
options?: Options,
): Promise<Stream>