Github

GitHub Download Module

GitHub archive download functionality.

Handles downloading release archives from GitHub repositories.

Interfaces

Type Aliases

Functions

GitHub Releases Module

GitHub releases API client.

Provides functions to query and resolve GitHub release versions.

Interfaces

Functions

constructArchiveUrl

TypeScript
function constructArchiveUrl(
   owner,
   repo,
   ref,
   refType,
   format?): string;

Defined in: packages/core/src/github/releases.ts:146

Construct a GitHub archive URL.

Parameters

Parameter Type Default value Description
owner string undefined Repository owner
repo string undefined Repository name
ref string undefined Git reference (tag, branch, or commit)
refType "tag" | "branch" | "commit" undefined Type of reference
format "zip" | "tarball" "zip" Archive format

Returns

string

Archive URL

downloadArchive

TypeScript
function downloadArchive(url, options?): Promise<string>;

Defined in: packages/core/src/github/download.ts:125

Download an archive from a URL.

Parameters

Parameter Type Description
url string URL to download
options { auth?: AuthConfig; downloadDir?: string; extension?: string; onProgress?: DownloadProgressCallback; signal?: AbortSignal; timeout?: number; } Download options
options.auth? AuthConfig -
options.downloadDir? string -
options.extension? string -
options.onProgress? DownloadProgressCallback -
options.signal? AbortSignal -
options.timeout? number -

Returns

Promise<string>

Path to downloaded file

downloadFromUrl

TypeScript
function downloadFromUrl(url, options?): Promise<string>;

Defined in: packages/core/src/github/download.ts:285

Download from a custom URL (non-GitHub).

Parameters

Parameter Type Description
url string URL to download
options { auth?: AuthConfig; downloadDir?: string; onProgress?: DownloadProgressCallback; signal?: AbortSignal; timeout?: number; } Download options
options.auth? AuthConfig -
options.downloadDir? string -
options.onProgress? DownloadProgressCallback -
options.signal? AbortSignal -
options.timeout? number -

Returns

Promise<string>

Path to downloaded file

downloadGitHubArchive

TypeScript
function downloadGitHubArchive(
   owner,
   repo,
   version,
options?): Promise<DownloadResult>;

Defined in: packages/core/src/github/download.ts:69

Download an archive from GitHub.

Parameters

Parameter Type Description
owner string Repository owner
repo string Repository name
version VersionSpec Version specification
options DownloadOptions Download options

Returns

Promise<DownloadResult>

Download result

fetchReleases

TypeScript
function fetchReleases(
   owner,
   repo,
options?): Promise<GitHubRelease[]>;

Defined in: packages/core/src/github/releases.ts:263

Fetch releases for a repository.

Parameters

Parameter Type Description
owner string Repository owner
repo string Repository name
options GitHubOptions GitHub options

Returns

Promise<GitHubRelease[]>

Array of releases

fetchTags

TypeScript
function fetchTags(
   owner,
   repo,
options?): Promise<GitHubTag[]>;

Defined in: packages/core/src/github/releases.ts:304

Fetch tags for a repository.

Parameters

Parameter Type Description
owner string Repository owner
repo string Repository name
options GitHubOptions GitHub options

Returns

Promise<GitHubTag[]>

Array of tags

getLatestRelease

TypeScript
function getLatestRelease(
   owner,
   repo,
options?): Promise<GitHubRelease | null>;

Defined in: packages/core/src/github/releases.ts:335

Get the latest release for a repository.

Parameters

Parameter Type Description
owner string Repository owner
repo string Repository name
options GitHubOptions GitHub options

Returns

Promise<GitHubRelease | null>

Latest release or null if none

resolveVersion

TypeScript
function resolveVersion(
   owner,
   repo,
   version,
options?): Promise<ResolvedVersion>;

Defined in: packages/core/src/github/releases.ts:353

Resolve a version specification to a release or tag.

Parameters

Parameter Type Description
owner string Repository owner
repo string Repository name
version VersionSpec Version specification
options ResolveVersionOptions Resolution options

Returns

Promise<ResolvedVersion>

Resolved release/tag info with download URL

DownloadOptions

Defined in: packages/core/src/github/download.ts:37

Options for downloading archives.

Extends

Properties

Property Type Description Inherited from Defined in
auth? AuthConfig Authentication configuration. ResolveVersionOptions.auth packages/core/src/github/releases.ts:84
defaultBranch? string Default branch to use when no releases/tags exist. ResolveVersionOptions.defaultBranch packages/core/src/github/releases.ts:98
downloadDir? string Custom download directory (uses temp by default). - packages/core/src/github/download.ts:43
format? "zip" | "tarball" Preferred archive format. - packages/core/src/github/download.ts:39
includePrereleases? boolean Include prereleases when resolving versions. ResolveVersionOptions.includePrereleases packages/core/src/github/releases.ts:88
latestCommit? string Latest commit SHA on default branch (for fallback). ResolveVersionOptions.latestCommit packages/core/src/github/releases.ts:100
onProgress? DownloadProgressCallback Progress callback. - packages/core/src/github/download.ts:41
signal? AbortSignal AbortSignal for cancellation. ResolveVersionOptions.signal packages/core/src/github/releases.ts:90
timeout? number Request timeout in milliseconds. ResolveVersionOptions.timeout packages/core/src/github/releases.ts:86

DownloadResult

Defined in: packages/core/src/github/download.ts:49

Result of a download operation.

Properties

Property Type Description Defined in
archivePath string Path to the downloaded archive. packages/core/src/github/download.ts:51
commitSha? string Commit SHA if resolved to a commit (first 7 characters). packages/core/src/github/download.ts:57
format "zip" | "tarball" Archive format. packages/core/src/github/download.ts:55
tagName string Resolved tag/version name. packages/core/src/github/download.ts:53

GitHubOptions

Defined in: packages/core/src/github/releases.ts:82

Options for GitHub API requests.

Extended by

Properties

Property Type Description Defined in
auth? AuthConfig Authentication configuration. packages/core/src/github/releases.ts:84
includePrereleases? boolean Include prereleases when resolving versions. packages/core/src/github/releases.ts:88
signal? AbortSignal AbortSignal for cancellation. packages/core/src/github/releases.ts:90
timeout? number Request timeout in milliseconds. packages/core/src/github/releases.ts:86

GitHubRelease

Defined in: packages/core/src/github/releases.ts:22

GitHub release information.

Properties

Property Type Description Defined in
draft boolean Whether this is a draft. packages/core/src/github/releases.ts:38
htmlUrl string URL to the release page. packages/core/src/github/releases.ts:32
name string Release name/title. packages/core/src/github/releases.ts:26
prerelease boolean Whether this is a prerelease. packages/core/src/github/releases.ts:36
publishedAt string ISO timestamp when published. packages/core/src/github/releases.ts:34
tagName string Release tag name (e.g., “v1.0.0”). packages/core/src/github/releases.ts:24
tarballUrl string URL to download the tarball. packages/core/src/github/releases.ts:30
zipballUrl string URL to download the zipball. packages/core/src/github/releases.ts:28

GitHubTag

Defined in: packages/core/src/github/releases.ts:44

GitHub tag information.

Properties

Property Type Description Defined in
name string Tag name. packages/core/src/github/releases.ts:46
sha string Commit SHA. packages/core/src/github/releases.ts:48
tarballUrl string URL to download the tarball. packages/core/src/github/releases.ts:52
zipballUrl string URL to download the zipball. packages/core/src/github/releases.ts:50

ResolvedVersion

Defined in: packages/core/src/github/releases.ts:106

Result of version resolution.

Properties

Property Type Description Defined in
commitSha? string Commit SHA if resolved to a commit (first 7 characters). packages/core/src/github/releases.ts:114
tagName string Resolved tag/version name. packages/core/src/github/releases.ts:108
tarballUrl string URL to download the tarball. packages/core/src/github/releases.ts:112
zipballUrl string URL to download the zipball. packages/core/src/github/releases.ts:110

ResolveVersionOptions

Defined in: packages/core/src/github/releases.ts:96

Options for version resolution.

Extends

Extended by

Properties

Property Type Description Inherited from Defined in
auth? AuthConfig Authentication configuration. GitHubOptions.auth packages/core/src/github/releases.ts:84
defaultBranch? string Default branch to use when no releases/tags exist. - packages/core/src/github/releases.ts:98
includePrereleases? boolean Include prereleases when resolving versions. GitHubOptions.includePrereleases packages/core/src/github/releases.ts:88
latestCommit? string Latest commit SHA on default branch (for fallback). - packages/core/src/github/releases.ts:100
signal? AbortSignal AbortSignal for cancellation. GitHubOptions.signal packages/core/src/github/releases.ts:90
timeout? number Request timeout in milliseconds. GitHubOptions.timeout packages/core/src/github/releases.ts:86

DownloadProgressCallback

TypeScript
type DownloadProgressCallback = (progress) => void;

Defined in: packages/core/src/github/download.ts:26

Progress callback for downloads.

Parameters

Parameter Type
progress { bytesDownloaded?: number; message: string; percentage?: number; phase: "resolving" | "downloading"; totalBytes?: number; }
progress.bytesDownloaded? number
progress.message string
progress.percentage? number
progress.phase "resolving" | "downloading"
progress.totalBytes? number

Returns

void

Back to top

Reuse

MIT