Module: utils/objectStorage

Storage adapter for local artifacts and S3-compatible object stores.

Source:

Methods

(static) readArtifactBuffer(args) → {Promise.<(Buffer|null)>}

Read an artifact buffer. In local mode, reads from absolutePath. In s3 mode, fetches the object via a short-lived pre-signed GET URL and falls back to the local copy (dual-write safety net) on failure.

Parameters:
Name Type Description
args Object
Properties
Name Type Description
artifactPath string

URL path, e.g. /artifacts/baselines/…

absolutePath string

Local filesystem fallback path.

Source:
Returns:
Type
Promise.<(Buffer|null)>

(static) s3PublicOrigin() → {string|null}

Origin (scheme + host, no path) that pre-signed S3 artifact URLs are served from. Used by the CSP middleware in appSetup.js to allow the browser to load <img> / <video> artifacts from the configured object store.

Returns null when S3 is not configured or the endpoint cannot be parsed — callers should treat that as "no S3 origin to allow" and fall back to same-origin-only CSP.

Source:
Returns:
Type
string | null

(inner) rfc3986()

RFC 3986 encoder per AWS SigV4 spec. encodeURIComponent is RFC 3986 compliant except it does not encode !*'() — AWS requires those encoded (except in the path, where / is preserved by joining segments).

Source: