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

bower-registry-file-client

v0.2.6

Published

Provides easy interaction with the Bower registry.

Downloads

10

Readme

bower-registry-client Build Status

This module allows you to easily interact with the Bower server API.

Usage


var RegistryClient = require('bower-registry-client');
var registry = new RegistryClient(options, logger);

The logger is optional and is expected to be an instance of the bower logger.
Available constructor options:

  • cache: the cache folder to use for some operations; using null will disable persistent cache (defaults to bower registry cache folder)
  • registry.search: an array of registry search endpoints (defaults to the Bower server)
  • registry.register: the endpoint to use when registering packages (defaults to the Bower server)
  • registry.publish: the endpoint to use when publishing packages (defaults to the Bower server)
  • ca.search: an array of CA certificates for each registry.search (defaults to null).
  • ca.register: the CA certificate for registry.register
  • ca.publish: the CA certificate for registry.publish
  • proxy: the proxy to use for http requests (defaults to null)
  • httpsProxy: the proxy to use for https requests (defaults to null)
  • strictSsl: whether or not to do SSL key validation when making requests via https (defaults to true).
  • userAgent: the user agent to use for the requests (defaults to null)
  • timeout: the timeout for the requests to finish (defaults to 60000)
  • force: If set to true, cache will be bypassed and remotes will always be hit (defaults to false).
  • offline: If set to true, only the cache will be used (defaults to false).

Note that force and offline are mutually exclusive. The cache will speedup operations such as list, lookup and search. Different operations may have different cache expiration times.

.lookup(name, callback)

Looks the registry for the package name,

registry.lookup('jquery', function (err, entry) {
    if (err) {
        console.error(err.message);
        return;
    }

    // For now resp.type is always 'alias'
    console.log('type', entry.type);
    console.log('url', entry.url);
});

.register(name, url, callback)

Registers a package in the registry.

registry.register('my-package', 'git://github.com/my-org/my-package.git', function (err, pkg) {
    if (err) {
        console.error(err.message);
        return;
    }

    console.log('name', pkg.name);
    console.log('url: ', pkg.url);
});

.search(str, callback)

Searches the registry.

registry.search('jquery', function (err, results) {
    if (err) {
        console.error(err.message);
        return;
    }

    results.forEach(function (pkg) {
        console.log('name', pkg.name);
        console.log('url', pkg.url);
    });
});

.clearCache(name, callback)

Clears the persistent and runtime cache associated with the name package.
If name is null, clears the cache for every package.

Note that in most cases, you don't need to clear the cache since it has self expiration times.

// Clear jquery cache
registry.clearCache('jquery', function (err) {
    if (err) {
        console.error(err.message);
        return;
    }

    console.log('Done');
});

// Clear all cache
registry.clearCache(function (err) {
    if (err) {
        console.error(err.message);
        return;
    }

    console.log('Done');
});

.resetCache()

Clears the in-memory cache used to speed up the instance.

Note that in most cases, you don't need to clear the runtime cache since it has self expiration times. Might be useful if you use this module in long-living programs.

registry.resetCache();

#clearRuntimeCache()

Clears the in-memory cache used to speed up the whole module. This clears the static in-memory cache as well as in-memory cache used by instances.

Note that in edge cases, some instance's in-memory cache might be skipped. If that's a problem, you should create fresh instances instead.

RegistryClient.clearRuntimeCache();

License

Released under the MIT License.