Node.js SDK reference (@argos-ci/core)
Upload screenshots and standalone media programmatically from Node.js scripts, or build your own Argos integration with @argos-ci/core.
@argos-ci/core is the low-level SDK every Argos integration builds on. Use it to upload screenshots from your own Node.js scripts or to build a custom integration. It is available as an npm package; the source code is on GitHub.
Installation
npm install --save-dev @argos-ci/coreCompatibility
Node.js 22 or later.
Usage
To upload screenshots from a ./screenshots directory, use the upload function:
import { upload } from "@argos-ci/core";
await upload({ root: "./screenshots" });upload accepts the same options as the CLI upload command — files globs, build name, mode, parallel settings, threshold, and more.
Uploading standalone media
uploadMedia uploads images or videos on their own — no build, no comparison — and returns each one's share URL and a ready-to-paste Markdown embed:
import { uploadMedia } from "@argos-ci/core";
const [media] = await uploadMedia({
files: ["checkout-after.png"],
// Stage the media on the branch: Argos publishes it — and posts the pull
// request comment — by itself once a pull request opens for that branch.
branch: "feat/checkout",
});
// The `-after` suffix is lifted off the name: this media is
// `checkout.png`, labelled `after`.
console.log(media.url); // https://app.argos-ci.com/m/…
console.log(media.markdown); // Re-uploading the same name adds a version and keeps the URL, so Markdown already posted to a pull request shows the newest upload. Options mirror the CLI media upload command: token, project, branch, prNumber, state, description, visibility (defaults to the project's — public for a public project, team for a private one), and compress (true by default — images are converted to WebP before upload). It returns one media per file, uploaded sequentially in input order. See Media sharing for retention, visibility and billing.
API reference
For a detailed breakdown of the available functions and options, see the SDK reference documentation.
Last updated
Was this helpful?