Registry / devops / gh-release-fetch

gh-release-fetch

JSON →
library4.0.3jsnpmunverified

A thin wrapper library (v4.0.3, maintained) for fetching release binaries from GitHub Releases. Provides simple functions to download the latest or a specific release asset. Distinguishes itself by being lightweight and focused solely on downloading release assets, with no dependency on the full GitHub API. Works with Node.js (^14.18.0 || ^16.13.0 || >=18.0.0).

npm install gh-release-fetch
INSTALL
IMPORT
SIG · GH-RELEASE-FETCH
G
gh-release-fetch
devopsjavascriptv4.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fetchLatest
import { fetchLatest } from 'gh-release-fetch'
const fetchLatest = require('gh-release-fetch').fetchLatest
ESM-only since v4 (type: module). Use named import.
fetchRelease
import { fetchRelease } from 'gh-release-fetch'
import fetchRelease from 'gh-release-fetch'
Named export, not default.
isPrerelease
import { isPrerelease } from 'gh-release-fetch'
Utility to check if a version is a pre-release (e.g., includes 'beta').

Demonstrates downloading the latest release asset from a GitHub repository.

import { fetchLatest } from 'gh-release-fetch'; const repo = 'netlify/netlify-cli'; const pkg = 'cli.tar.gz'; const dest = './dist'; fetchLatest({ repository: repo, package: pkg, destination: dest }) .then(() => console.log('Downloaded latest release!')) .catch(err => console.error(err));
Debug
Known issues
breakingPackage is ESM-only since version 4. CommonJS require() will fail.
fix
Use import syntax or dynamic import(). If using CommonJS, stick with v3.
affects: >=4.0.0
gotchaThe 'package' option conflicts with JavaScript reserved word. Must be used as object key.
fix
Always use object syntax { package: 'filename' }, not bare variable named 'package'.
affects: all
gotchaGitHub API rate limiting may cause failures for unauthenticated requests.
fix
Set GITHUB_TOKEN environment variable or pass token option for higher limits.
affects: all
deprecatedfetchLatest no longer accepts a string as first argument. Use object parameter.
fix
Wrap arguments in an object: { repository: 'org/repo', package: 'file', destination: 'path' }
affects: >=3.0.0
Errors
Common errors & fixes
Cannot find module 'gh-release-fetch'
Package not installed or ESM-only in Node.js without {type:'module'}.
fix
Run npm install gh-release-fetch. If using CommonJS, use dynamic import() or upgrade project to ESM.
TypeError: fetchLatest(...).then is not a function
Using CommonJS require() on ESM-only package.
fix
Use import { fetchLatest } from 'gh-release-fetch' or use dynamic import('gh-release-fetch').then(...).
Request failed with status code 404
Invalid repository, package name, or tag.
fix
Verify the repository name (org/repo), package filename (case-sensitive), and tag (if using fetchRelease).
Upgrade
Version history
4.0.3latest on npm
Audit
Dependencies
node-fetchrequiredHTTP requests to GitHub API and asset downloads
Agent activity
4 hits · last 30 days
node
4
Resources
gh-release-fetch — npm install gh-release-fetch · libregistry