npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

artifactory-client-node

v0.0.15

Published

Artifactory REST Client Node

Downloads

9,054

Readme

artifactory-client-node

Artifactory Node client provides simple yet powerful Artifactory connection and management within your Node code.

Getting Started

Add artifactory-client-node as a dependency to your node package.

npm install artifactory-client-node --save

Examples:

This section includes a few usage examples of the Node client APIs from your application code.

Setting up Artifactory

Crete artifactory configuration file. e.g artifactory.json

{
    "serverId": "dev",
    "url": "http://jainish.artifactory.com/artifactory",
    "user": "admin",
    "password": "password"
}

set environment variable ARTIFACTORY_CONFIG_FILE with absolute path to artifactory configuration file.

export ARTIFACTORY_CONFIG_FILE=/users/home/jainishshah17/artifactory-client-node/artifactory.json

Note: If you are using Self-signed SSL certificate. Set environment variable export NODE_TLS_REJECT_UNAUTHORIZED=0 to ignore SSL check.

Artifactory Health Check

  var artCli = require('artifactory-client-node');
  var art = new artCli.artifactory();

  var ping = art.ping();
  ping.then(function (result) {
      console.log(result);
  }, function (err) {
      console.log(err);
  });

Artifactory System Information

  var artCli = require('artifactory-client-node');
  var art = new artCli.artifactory();

  var system = art.system();
  system.then(function (result) {
      console.log(result);
  }, function (err) {
      console.log(err);
  });

Artifactory get licenses

  var artCli = require('artifactory-client-node');
  var art = new artCli.artifactory();

    var licenses = art.getLicenses();
    licenses.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory version

  var artCli = require('artifactory-client-node');
  var art = new artCli.artifactory();
    var version = art.getVersion();
    version.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory system storage information

  var artCli = require('artifactory-client-node');
  var art = new artCli.artifactory();

    var storage = art.getStorage();
    storage.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory Upload build

  var artCli = require('artifactory-client-node');
  var build = new artCli.build();
    var uploadBuild8 = build.uploadBuild("./test/resources/build8.json");
    uploadBuild8.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory get all builds

  var artCli = require('artifactory-client-node');
  var build = new artCli.build();

  var allBuilds = build.getAllBuild();
    allBuilds.then(function (result) {
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory get build

  var artCli = require('artifactory-client-node');
  var build = new artCli.build();

  var testBuild = build.getBuild("test");
    testBuild.then(function (result) {
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory promote build

  var artCli = require('artifactory-client-node');
  var build = new artCli.build();

    var promoteBuild = build.promoteBuild("art-test", 8, "./test/resources/promote.json");
    promoteBuild.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory get build information

  var artCli = require('artifactory-client-node');
  var build = new artCli.build();
  var build2 = build.getBuildInfo("art-test", 2);
    build2.then(function (result) {
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory get build difference

  var artCli = require('artifactory-client-node');
  var art = new artCli.artifactory();
    var buildDiff = build.getBuildDiff("test", 2, 1);
    buildDiff.then(function (result) {
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory delete builds

  var artCli = require('artifactory-client-node');
  var build = new artCli.build();
    var buildDelete = build.deleteBuilds("test", "2,1", "artifacts=1");
    buildDelete.then(function (result) {
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory delete all builds

  var artCli = require('artifactory-client-node');
  var build = new artCli.build();
    var deleteAll = build.deleteAllBuilds("art-test", "artifacts=1");
    deleteAll.then(function (result) {
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory get folder Info

  var artCli = require('artifactory-client-node');
  var artifacts = new artifactory.artifacts();
    var folderInfo = artifacts.getFolderInfo("generic-local/folder");
    folderInfo.then(function (result) {
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory get file Info

  var artCli = require('artifactory-client-node');
  var artifacts = new artifactory.artifacts();
  var fileInfo = artifacts.getFileInfo("generic-local/folder/my-package-3.3.1.tgz");
    fileInfo.then(function (result) {
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory get file stats

  var artCli = require('artifactory-client-node');
  var artifacts = new artifactory.artifacts();
  var fileStats = artifacts.getFileStats("generic-local/folder/my-package-3.3.1.tgz");
    fileStats.then(function (result) {
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory get file properties

  var artCli = require('artifactory-client-node');
  var artifacts = new artifactory.artifacts();
    var fileProps = artifacts.getFileProps("generic-local/folder/my-package-3.3.1.tgz", "");
    fileProps.then(function (result) {
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory delete artifacts

  var artCli = require('artifactory-client-node');
  var artifacts = new artifactory.artifacts();
    var deleteArtifact =  artifacts.deleteFile("generic-local/artifactory.jpg");
    deleteArtifact.then(function (result) {
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory upload artifact

  var artCli = require('artifactory-client-node');
  var artifacts = new artifactory.artifacts();
    var uploadFile = artifacts.uploadFile("generic-local/folder/test.zip", "/Users/jainish.shah/development/jainishshah17/artifactory-client-node/test.zip");
    uploadFile.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory upload artifact with properties

  var artCli = require('artifactory-client-node');
  var artifacts = new artifactory.artifacts();
    var uploadFileWihProps = artifacts.uploadFile("generic-local/folder/test.tar", "/Users/jainish.shah/development/jainishshah17/artifactory-client-node/test.tar", ";test=passed");
    uploadFileWihProps.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory create user

  var artCli = require('artifactory-client-node');
  var security = new artifactory.security();
    
    var creatUser = security.createUser("jainishs", "./test/resources/user.json");
    creatUser.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory get all users

  var artCli = require('artifactory-client-node');
  var security = new artifactory.security();
   
   var getAllUsers = security.getAllUsers();
    getAllUsers.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory get user

  var artCli = require('artifactory-client-node');
  var security = new artifactory.security();
   
    var getUser = security.getUser("jainishs");
    getUser.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory encrypted password

  var artCli = require('artifactory-client-node');
  var security = new artifactory.security();
   
    var encryptedPassword = security.getEncryptedPassword();
    encryptedPassword.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory create API key

  var artCli = require('artifactory-client-node');
  var security = new artifactory.security();
   
    var createApiKey = security.createApiKey();
    createApiKey.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory regenerate API key

  var artCli = require('artifactory-client-node');
  var security = new artifactory.security();
   
    var regenApiKey = security.regenerateApiKey();
    regenApiKey.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory get API key

  var artCli = require('artifactory-client-node');
  var security = new artifactory.security();
   
    var getApiKey = security.getApiKey();
    getApiKey.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory revoke API key

  var artCli = require('artifactory-client-node');
  var security = new artifactory.security();
   
    var revokeApiKey = security.revokeApiKey();
    revokeApiKey.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory revoke user API key

  var artCli = require('artifactory-client-node');
  var security = new artifactory.security();
   
    var revokeUserApiKey = security.revokeUserApiKey("jainishs");
    revokeUserApiKey.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory create permission

  var artCli = require('artifactory-client-node');
  var security = new artifactory.security();
    
    var createPermission = security.createPermission("developers", "./test/resources/permission.json");
    createPermission.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory get all permission

  var artCli = require('artifactory-client-node');
  var security = new artifactory.security();
   
   var getAllPermission = security.getAllPermission();
    getAllPermission.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory get permission

  var artCli = require('artifactory-client-node');
  var security = new artifactory.security();
   
    var getPermission = security.getPermission("developers");
    getPermission.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });

Artifactory delete permission

  var artCli = require('artifactory-client-node');
  var security = new artifactory.security();
   
    var deletePermission = security.deletePermission("developers");
    deletePermission.then(function (result) {
        var result = result;
        console.log(result)
    }, function (err) {
        console.log(err);
    });