nodedist

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 13 Imported by: 0

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

View Source
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

func Download(ctx context.Context, version, archiveName string) (string, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL