Skip to content

feat!: replace got with native fetch as default downloader#376

Draft
MarshallOfSound wants to merge 4 commits intomainfrom
claude/replace-got-with-fetch-AR2RN
Draft

feat!: replace got with native fetch as default downloader#376
MarshallOfSound wants to merge 4 commits intomainfrom
claude/replace-got-with-fetch-AR2RN

Conversation

@MarshallOfSound
Copy link
Member

Summary

This is a proposed breaking change to reduce the dependency footprint of @electron/get by replacing the got HTTP client with Node's built-in fetch API.

Motivation

got is a heavyweight dependency with its own transitive dependency tree. Since @electron/get requires Node 22.12+, native fetch is guaranteed to be available and is sufficient for our use case of streaming file downloads.

Dependency changes

Dependency Before After
got ^14.4.5 (dependency) ❌ removed
global-agent ^3.0.0 (optional) ❌ removed
undici ^7.24.4 (optional, proxy support only)

Breaking changes

  • GotDownloaderFetchDownloader: The default downloader class has been renamed. The old GotDownloader export has been removed.
  • GotDownloaderOptionsFetchDownloaderOptions: Download options now extend RequestInit instead of got's Options. The getProgressCallback and quiet options are preserved.
  • initializeProxy(): Now uses undici's EnvHttpProxyAgent instead of global-agent. Reads HTTP_PROXY / HTTPS_PROXY / NO_PROXY directly (the GLOBAL_AGENT_* prefixed variables are no longer supported).

Preserved behavior

  • getProgressCallback receives a Progress object with transferred, total, and percent (same shape as got's progress events)
  • Progress bar appears after 30 seconds (configurable via quiet or ELECTRON_GET_NO_PROGRESS)
  • 404 errors throw HTTPError with message format Response code 404 (Not Found) for ${url}
  • Parent directories are auto-created before download
  • ELECTRON_GET_USE_PROXY still auto-initializes proxy support

New exports

  • FetchDownloader — the new default downloader class
  • FetchDownloaderOptions — options type extending RequestInit
  • HTTPError — error class (previously re-exported from got)
  • Progress — progress interface (previously re-exported from got)

claude added 3 commits March 24, 2026 08:30
BREAKING CHANGE: The default downloader now uses the built-in Fetch API
instead of the got package. The GotDownloader and GotDownloaderOptions
exports are deprecated aliases for the new FetchDownloader and
FetchDownloaderOptions. Download options now accept RequestInit options
instead of got options. The initializeProxy() function now uses undici's
EnvHttpProxyAgent instead of global-agent, reading HTTP_PROXY/HTTPS_PROXY/
NO_PROXY environment variables directly.
@socket-security
Copy link

socket-security bot commented Mar 24, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedundici@​7.24.47210010098100

View full report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants