Documentation
¶
Overview ¶
Package nodedist is a small client for the official Node.js distribution at https://nodejs.org/dist. It exposes the embedded release index and a SHA-256 verifying downloader.
The package is intentionally infrastructure-only: it knows nothing about Single Executable Applications, version resolution from project files, target/GOOS mapping, or build orchestration. Callers (typically the nodesea package) layer those concerns on top.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Releases = sync.OnceValue(func() map[string]map[string]string { var m map[string]map[string]string if err := json.Unmarshal(rawReleases, &m); err != nil { panic(fmt.Sprintf("nodedist: decode embedded releases.json: %v", err)) } return m })
Releases returns the embedded Node.js release index, decoded once and cached for the lifetime of the process. Each entry maps an archive name (matching what Target.ArchiveName returns) to its SHA-256, hex-encoded.
Functions ¶
func Download ¶
Download fetches https://nodejs.org/dist/<version>/<archiveName> into a fresh temp file, verifies its SHA-256 against the embedded release index, and returns the local file path. Each call hits the network — there is no on-disk cache. The temp file lives under os.TempDir() and is reaped by the OS on its usual schedule.
The caller owns extraction (for tar.gz archives) and any further mutation (e.g. stripping a code signature) before use.
Types ¶
This section is empty.