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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vuforia-api

v0.3.2

Published

Node.js client for the Vuforia Web Services API (VWS API) and the Vuforia Web Query API (VWQ API)

Downloads

289

Readme

vuforiajs

Node.js client for the Vuforia Web Services API (VWS API) and the Vuforia Web Query API (VWQ API).

usage

// load module
var vuforia = require('vuforia-api');

// init client with valid credentials
var client = vuforia.client({

    // Server access key (used for Vuforia Web Services API)
    'serverAccessKey': 'your server access key',

    // Server secret key (used for Vuforia Web Services API)
    'serverSecretKey': 'your server secret key',

    // Client access key (used for Vuforia Web Query API)
    'clientAccessKey': 'your client access key',

    // Client secret key (used for Vuforia Web Query API)
    'clientSecretKey': 'your client secret key'
});

// util for base64 encoding and decoding
var util = vuforia.util();

create a new target

var target = {

    // name of the target, unique within a database
    'name': 'my target',
    // width of the target in scene unit
    'width': 32.0,
    // the base64 encoded binary recognition image data
    'image': util.encodeFileBase64(__dirname + '/someImage.png'),
    // indicates whether or not the target is active for query
    'active_flag': true,
    // the base64 encoded application metadata associated with the target
    'application_metadata': util.encodeBase64('some metadata about your image')
};

add target to cloud database

client.addTarget(target, function (error, result) {

    if (error) { // e.g. [Error: AuthenticationFailure]

        console.error(result);

        /*
        example of result from the vws API:
        {
        	result_code: 'AuthenticationFailure',
        	transaction_id: '58b51ddc7a2c4ac58d405027acf5f99a'
        }
        */

    } else {

    	console.log(result);

        /*
        example of result from the vws API:
        {
        	target_id: '93fd6681f1r74b76bg80tf736a11b6a9',
        	result_code: 'TargetCreated',
        	transaction_id: 'xf157g63179641c4920728f1650d1626'
        }
        */
    }
});

list all targets within cloud database

client.listTargets(function (error, result) {

	if (error) { // e.g. [Error: AuthenticationFailure]

        console.error(result);

        /*
        example of result from the vws API:
        {
        	result_code: 'AuthenticationFailure',
        	transaction_id: '58b51ddc7a2c4ac58d405027acf5f99a'
        }
        */

    } else {

    	console.log(result);

        /*
	    example of result from the vws API:
	    {
	        “result_code”:”Success”,
	        “transaction_id”:”550e8400e29440000b41d4a716446655”,
	        “results”:[
	            ”00550e84e29b41d4a71644665555678”,
	            ”578fe7fd60055a5a84c2d215066b7a9d”
	        ]
	    }
	    */
    }
});             

retrieve a target from cloud database

client.retrieveTarget('00550e84e29b41d4a71644665555678', function (error, result) {

    if (error) { // e.g. [Error: AuthenticationFailure]

        console.error(result);

        /*
        example of result from the vws API:
        {
        	result_code: 'AuthenticationFailure',
        	transaction_id: '58b51ddc7a2c4ac58d405027acf5f99a'
        }
        */

    } else {

    	console.log(result);

        /*
        example of result from the vws API:
        {
            “result_code”:”Success”,
            “transaction_id”:”e29b41550e8400d4a716446655440000”,
            “target_record”:{
                “target_id”:”550b41d4a7164466554e8400e2949364”,
                “active_flag”:true,
                “name”:”tarmac”,
                “width”:100.0,
                “tracking_rating”:4,
                “reco_rating”:””
            },
            “status”:”Success”
        }
        */
    }
});

update a target

var update = {

    'active_flag' : true,
    'application_metadata' : util.encodeBase64('Some metadata about your image')
};

client.updateTarget('00550e84e29b41d4a71644665555678', update, function (error, result) {

	if (error) { // e.g. [Error: AuthenticationFailure]

        console.error(result);

        /*
        example of result from the vws API:
        {
        	result_code: 'AuthenticationFailure',
        	transaction_id: '58b51ddc7a2c4ac58d405027acf5f99a'
        }
        */

    } else {

    	console.log(result);

        /*
	    example of result from the vws API:
	    {
	    	"result_code":"Success",
  			"transaction_id":"550e8400e29b41d4a716446655482752"
	    }
	    */
    }
});

delete a target

client.deleteTarget('00550e84e29b41d4a71644665555678', function (error, result) {

	if (error) { // e.g. [Error: AuthenticationFailure]

        console.error(result);

        /*
        example of result from the vws API:
        {
        	result_code: 'AuthenticationFailure',
        	transaction_id: '58b51ddc7a2c4ac58d405027acf5f99a'
        }
        */

    } else {

    	console.log(result);

        /*
	    example of result from the vws API:
	    {
	    	“result_code”:”Success”,
	    	“transaction_id”:”550e8400e29b41d4a716446655482752”
	    }
	    */
    }
});

search cloud database for images that can be considered duplicates

client.checkForDuplicateTargets('00550e84e29b41d4a71644665555678', function (error, result) {

    // images that are the same as the reference one identified by a given target id

    if (error) { // e.g. [Error: AuthenticationFailure]

        console.error(result);

        /*
        example of result from the vws API:
        {
        	result_code: 'AuthenticationFailure',
        	transaction_id: '58b51ddc7a2c4ac58d405027acf5f99a'
        }
        */

    } else {

    	console.log(result);

        /*
	    example of result from the vws API:
	    {
		    “similar_targets”:
		    [
		        ”550e8400e29b41d4a716446655447300”,
		        ”578fe7fd60055cbc84c2d215066b7a9d”
		    ]
	    }
	    */
    }
});

Perform an Image Recognition Query

var filename = __dirname + '/test.jpg'; // image file that will be send to the Vuforia Web Query API
var max_num_results = 5; // return only 5 matches

client.cloudRecoQuery(fs.readFileSync(filename, 'binary'), max_num_results, function (error, result) {

	if (error) { // e.g. [Error: AuthenticationFailure]

        console.error(result);

        /*
        example of result from the vwq API:
        {
        	result_code: 'AuthenticationFailure',
        	transaction_id: '58b51ddc7a2c4ac58d405027acf5f99a'
        }
        */

    } else {

    	console.log(result);

        /*
	    example of result from the vwq API:
	    { 
	        result_code: 'Success',
	        transaction_id: 'b66bef31ba394c86a7ea2ab7e35c93d1',
	        results: 
	        [ 
	            'eacbb1487c584dbb8741fb5a28b4228f' 
	        ] 
	    }
	    */
    }
});