fix: download p2pd on first use, using got#94
Open
tabcat wants to merge 5 commits into
Open
Conversation
npm v12 makes install scripts opt-in, and --ignore-scripts, pnpm and hardened CI already skip them. Keep the postinstall as a best-effort fast path, but fall back to downloading from path() (running the installer in a child process) when the binary is missing.
Draining a global-fetch response body stalls indefinitely on some platforms (notably GitHub's macos-26 runners); got reads it reliably and handles retries/backoff. Drops the now-unused browser-readablestream-to-it, it-to-buffer, p-retry and delay deps.
Member
Author
|
Note on retry handling: I dropped the custom Happy to restore the knobs if you'd prefer to keep them (got's |
tabcat
marked this pull request as ready for review
July 8, 2026 18:29
achingbrain
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
postinstalldownload is best-effort: npm v12 makes install scripts opt-in by default, and--ignore-scripts, pnpm and hardened CI already skip them, so the p2pd binary can silently go missing. Separately, the download used the globalfetch, whose response body drain stalls indefinitely on some platforms (e.g. GitHub's macos-26 runners).postinstallas a fast path, but download on first use as a fallback:path()runs the installer in a child process when the binary isn't present, so a skipped script heals itself. Passpath({ autoDownload: false })to resolve only an already-installed binary.gotinstead of the globalfetch. got reads the body reliably and handles retries/backoff itself (drops the now-unusedp-retry,delay,browser-readablestream-to-itandit-to-buffer).bin/p2pdships as a JS stub the installer replaces, sopath()treats that stub as not-installed and downloads on first call.Same approach as ipfs/npm-kubo#83.