Documentation
¶
Index ¶
- Constants
- func BinPath() string
- func Dir() string
- func Ensure() (string, error)
- func EnsureContext(ctx context.Context) (string, error)
- func EnsureWithOptions(ctx context.Context, opts Options) (string, error)
- func FailureMarker() string
- func Host() string
- func HostChromeShell(_ int) string
- func Supported() bool
- type Options
Constants ¶
const ( // Version is the pinned Chrome for Testing chrome-headless-shell build. // Smaller and faster than full Chromium for headless screenshots on Linux. Version = "152.0.7977.42" // DefaultDownloadTimeout bounds one whole download. Callers should put it on // the ctx they pass to EnsureContext, so every tool waits the same time. DefaultDownloadTimeout = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func BinPath ¶
func BinPath() string
BinPath returns the preferred executable path inside Dir, if present.
func Dir ¶
func Dir() string
Dir returns the on-disk cache directory for the pinned chrome-headless-shell.
func Ensure ¶
Ensure downloads chrome-headless-shell once into the shared browser cache and returns the executable path. It is a no-op download when the binary already exists. Callers should only invoke this when Supported() is true.
func EnsureContext ¶ added in v0.11.17
EnsureContext is like Ensure, but stops waiting for the shared download lock and cancels the browser download when ctx is done.
func EnsureWithOptions ¶ added in v0.11.17
EnsureWithOptions is like EnsureContext, with download options.
A failed download leaves a marker in the browser cache. For 24 hours after that, no download is tried and an error is returned at once, so callers fall back to their default browser without waiting. Delete the marker (FailureMarker) to try again sooner.
func FailureMarker ¶ added in v0.11.17
func FailureMarker() string
FailureMarker returns the path of the file that records a failed download.
func Host ¶
func Host() string
Host returns the Chrome for Testing chrome-headless-shell zip URL for linux/amd64. Other platforms should not use this host for downloads.
func HostChromeShell ¶
HostChromeShell is a go-rod launcher.Host-compatible adapter that ignores the revision argument and always returns the pinned chrome-headless-shell URL.