Registry / devops / jfrog-client-js

jfrog-client-js

JSON →
library2.9.0jsnpmunverified

JFrog Javascript Client (v2.9.0) wraps REST APIs for JFrog Artifactory, Xray, and Platform services. Provides methods for scanning dependencies, managing artifacts, and interacting with Xray's security features. It supports both username/password and access token authentication, with configurable retries and timeouts. Actively maintained by JFrog with regular releases. Key differentiator: official JFrog client for Node.js with TypeScript support, enabling programmatic access to JFrog DevOps security and artifact management tools.

npm install jfrog-client-js
INSTALL
IMPORT
SIG · JFROG-CLIENT-JS
J
jfrog-client-js
devopsjavascriptv2.9.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

JfrogClient
import { JfrogClient } from 'jfrog-client-js'
import JfrogClient from 'jfrog-client-js'
This is a named export, not default. Use named import.
JfrogClient
const { JfrogClient } = require('jfrog-client-js')
CommonJS require pattern. Ensure destructuring since it's a named export.
Type definitions
import type { JfrogClientConfig, XrayScanOutput } from 'jfrog-client-js'
Types are exported for configuration and scan results. Use import type for type-only imports in TypeScript.

Shows how to initialize the JFrog client with platform URL and access token, then call Xray ping.

import { JfrogClient } from 'jfrog-client-js'; const client = new JfrogClient({ platformUrl: process.env.JFROG_PLATFORM_URL ?? 'https://mycompany.jfrog.io', accessToken: process.env.JFROG_ACCESS_TOKEN ?? '', }); async function pingXray() { try { const result = await client.xray().system().ping(); console.log('Xray ping result:', result); } catch (error) { console.error('Failed to ping Xray:', error); } } pingXray();
Debug
Known issues
gotchaThe `platformUrl` must end with a trailing slash or API calls may fail.
fix
Ensure platformUrl ends with '/', e.g., 'https://mycompany.jfrog.io/'
affects: >=1.0.0
gotchaWhen using username/password authentication, do not provide an accessToken. Only one auth method should be used.
fix
Provide either { username, password } or { accessToken }, not both.
affects: >=1.0.0
deprecatedThe `registerForWebLogin` and `getAccessTokenFromWebLogin` methods are deprecated in favor of username/password or accessToken methods.
fix
Use direct authentication via constructor options instead of web login flow.
affects: >=2.0.0
gotchaRetry logic only applies to network errors and 5xx status codes by default. Client errors (4xx) do not trigger retries unless custom status codes are provided.
fix
To retry on 4xx, provide a custom retryOnStatusCode function.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: JfrogClient is not a constructor
Using default import when named import is required.
fix
Change import to: import { JfrogClient } from 'jfrog-client-js'
Error: The platform URL must be defined and start with http:// or https://
platformUrl is missing or malformed.
fix
Provide a valid platformUrl starting with http:// or https://
Error: Authentication method not set. Please provide either username+password or accessToken.
No authentication credentials provided.
fix
Add username/password or accessToken to the constructor options.
Upgrade
Version history
2.9.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
16
OpenAI (training)
1
Resources
jfrog-client-js — npm install jfrog-client-js · libregistry