Socket
Socket
Sign inDemoInstall

query-registry

Package Overview
Dependencies
64
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    query-registry

Query the npm registry


Version published
Maintainers
1
Created

Readme

Source

query-registry

Build status Coverage Language Dependencies npm bundle size npm License

This package exports a class, Registry, which provides methods to query the npm registry or a custom npm-like registry.

Features

  • Provides methods for common use cases:
    • Registry metadata
    • Packuments (package documents)
    • Package manifests
    • Download counts
    • Searching packages
  • Typed response data
  • Supports mirrors and custom npm-like registries
  • Supports caching network requests
  • Well documented and tested

Package Contents

View package contents on unpkg.

View repository on GitHub.

Install

Using npm:

npm i query-registry

Using yarn:

yarn add query-registry

Usage

Create the default registry backed by npm:

import { Registry } from 'query-registry';

const registry = new Registry();

// Output: `https://registry.npmjs.org`
console.log(registry.registry);

Create a custom registry:

import { Registry } from 'query-registry';

const registry = new Registry({
    registry: 'https://registry.example.com',
    mirrors: ['https://mirror.example.com'],
    api: 'https://api.example.com',
    suggestionsAPI: 'https://suggestions.example.com',
    cache: new Map(),
});

// Output: `https://registry.example.com`
console.log(registry.registry);

Get the package manifest for query-registry's latest version:

import { Registry } from 'query-registry';

(async () => {
    const registry = new Registry();
    const manifest = await registry.getPackageManifest('query-registry');

    // Output: `query-registry`
    console.log(manifest.name);
})();

Debug

Debug messages are available when the DEBUG environment variable is set to query-registry:

DEBUG="query-registry"

Test debug messages are available when the DEBUG environment variable is set to query-registry-test.

For more information, see the debug package.

License

MIT License

Copyright (c) 2020 Edoardo Scibona

See LICENSE file.

Keywords

FAQs

Last updated on 14 Jul 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc