Artifact Operations

Operations for querying and manipulating W&B artifacts

artifactLink(artifact): string

Gets the URL/link for accessing an artifact in the W&B UI.

Returns a direct link to view the artifact in the W&B web interface, useful for generating reports or sharing artifact references.

Parameters

Name Type Description
artifact Artifact The artifact to get the link for
const link = artifactLink(myArtifact);
console.log(View artifact: ${link});
// Output: https://wandb.ai/entity/project/artifacts/type/name
const artifacts = project.artifacts();
const markdown = artifacts.map(a => 
  - ${artifactName(a)}})
).join('\n');

See Also


artifactName

artifactName(artifact): string

Gets the name of an artifact.

Returns the artifact’s unique name within its project.

Parameters

Name Type Description
artifact Artifact The artifact to get the name from

Example: Display Artifact Names

artifacts.forEach(artifact => {
  console.log(Artifact: ${artifactName(artifact)});
});

Example: Filter by Name Pattern

const modelArtifacts = artifacts.filter(a => 
  artifactName(a).includes("model")
);

See Also


artifactVersionAlias

artifactVersionAlias(version): string

Gets the alias of an artifact version.

Returns the version alias (e.g., “latest”, “best”, “production”).

Parameters

Name Type Description
version ArtifactVersion The artifact version

Example: Find Production Version

const prodVersion = versions.find(v => 
  artifactVersionAlias(v) === "production"
);

See Also

artifactVersions - Get all versions


artifactVersionCreatedAt

artifactVersionCreatedAt(version): Date

Gets the creation date of an artifact version.

Returns when a specific version of the artifact was created.

Parameters

Name Type Description
version ArtifactVersion The artifact version to get creation date from

Example: Sort Versions by Date

const sorted = versions.sort((a, b) => 
  artifactVersionCreatedAt(a).getTime() - 
  artifactVersionCreatedAt(b).getTime()
);

See Also

artifactVersions - Get all versions


artifactVersionDigest

artifactVersionDigest(version): string

Gets the content digest/hash of an artifact version.

Returns the SHA256 digest used to verify artifact integrity.

Parameters

Name Type Description
version ArtifactVersion The artifact version

Example: Verify Artifact Integrity

const digest = artifactVersionDigest(version);
const expected = "sha256:abc123...";
if (digest !== expected) {
  console.error("Artifact integrity check failed!");
}

See Also

artifactVersions - Get all versions


artifactVersionNumber

artifactVersionNumber(version): number

Gets the version number of an artifact version.

Returns the numeric version identifier.

Parameters

Name Type Description
version ArtifactVersion The artifact version

Example: Get Latest Version Number

const versions = artifactVersions(artifact);
const maxVersion = Math.max(...versions.map(v => 
  artifactVersionNumber(v)
));
console.log(Latest version: v${maxVersion});

See Also

artifactVersions - Get all versions


artifactVersionSize

artifactVersionSize(version): number

Gets the size of an artifact version in bytes.

Returns the storage size of a specific artifact version.

Parameters

Name Type Description
version ArtifactVersion The artifact version to get size from

Example: Display Human-Readable Size

const bytes = artifactVersionSize(version);
const mb = (bytes / 1e6).toFixed(2);
console.log(Size: ${mb} MB);

Example: Find Large Artifacts

const largeVersions = versions.filter(v => 
  artifactVersionSize(v) > 1e9 // > 1GB
);

See Also

artifactVersions - Get all versions


artifactVersions

artifactVersions(artifact): ArtifactVersion[]

Gets all versions of an artifact.

Returns an array of all version objects for the artifact, including version numbers, aliases, sizes, and timestamps.

Parameters

Name Type Description
artifact Artifact The artifact to get versions from

Example: List All Versions

const versions = artifactVersions(myArtifact);
versions.forEach(v => {
  console.log(v${v.version}: ${v.alias} (${v.size} bytes));
});

Example: Find Latest Version

const versions = artifactVersions(artifact);
const latest = versions.find(v => v.alias === "latest");
if (latest) {
  console.log(Latest is v${latest.version});
}

Example: Calculate Total Storage

const versions = artifactVersions(artifact);
const totalSize = versions.reduce((sum, v) => sum + v.size, 0);
console.log(Total storage: ${(totalSize / 1e9).toFixed(2)} GB);

See Also