query-registry
Query the npm registry for packuments, manifests, packages and download counts
Last updated 4 years ago by velut .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install query-registry 
SYNC missed versions from official npm registry.

query-registry

Build status Coverage jsDocs.io Language npm bundle size npm License

This package exports several functions to query the npm registry (or one of its mirrors) through one of its endpoints.

Features

  • Provides functions to:
    • Get registry metadata
    • Get packuments (package documents) and their abbreviated form
    • Get package manifests
    • Get download counts (packages and registry)
    • Search packages
  • Usable in the browser
  • Fully typed API and response data
  • Supports mirrors of the npm registry
  • Supports caching network requests
  • Well documented and tested

API & Package Info

Install

Using npm:

npm i query-registry

Using yarn:

yarn add query-registry

Usage Examples

Get the metadata for the npm registry:

import { getRegistryMetadata } from 'query-registry';

(async () => {
    const metadata = await getRegistryMetadata();

    // Output: 'registry'
    console.log(metadata.db_name);
})();

Get the latest manifest for package query-registry from the npm registry:

import { getPackageManifest } from 'query-registry';

(async () => {
    const manifest = await getPackageManifest({ name: 'query-registry' });

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

Get the abbreviated packument for package query-registry from the npm registry:

import { getAbbreviatedPackument } from 'query-registry';

(async () => {
    const packument = await getAbbreviatedPackument({ name: 'query-registry' });

    // Output: 'query-registry'
    console.log(packument.name);
})();

Get the weekly downloads for package query-registry from the npm registry:

import { getPackageDownloads } from 'query-registry';

(async () => {
    const downloads = await getPackageDownloads({ name: 'query-registry' });

    // Output: 'query-registry'
    console.log(downloads.package);

    // Output: 'number'
    console.log(typeof downloads.downloads);
})();

Get the search results for text query query-registry from the npm registry:

import { searchPackages } from 'query-registry';

(async () => {
    const results = await searchPackages({
        query: { text: 'query-registry' },
    });

    // Output: 'query-registry'
    console.log(results.objects[0].package.name);
})();

Debug

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

DEBUG="query-registry"

For more information, see the debug package.

License

MIT License

Copyright (c) 2021 Edoardo Scibona

See LICENSE file.

Current Tags

  • 2.6.0                                ...           latest (4 years ago)
  • 2.5.0-0                                ...           next (4 years ago)

21 Versions

  • 2.6.0                                ...           4 years ago
  • 2.5.0                                ...           4 years ago
  • 2.5.0-0                                ...           4 years ago
  • 2.4.0                                ...           4 years ago
  • 2.3.0                                ...           4 years ago
  • 2.3.0-0                                ...           4 years ago
  • 2.2.0                                ...           4 years ago
  • 2.2.0-0                                ...           4 years ago
  • 2.1.0-0                                ...           4 years ago
  • 2.0.0                                ...           5 years ago
  • 2.0.0-5                                ...           5 years ago
  • 2.0.0-4                                ...           5 years ago
  • 2.0.0-3                                ...           5 years ago
  • 2.0.0-2                                ...           5 years ago
  • 2.0.0-1                                ...           5 years ago
  • 2.0.0-0                                ...           5 years ago
  • 1.2.0                                ...           6 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.3.0                                ...           6 years ago
  • 0.2.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 7
Last Day 0
Last Week 11
Last Month 4
Dependencies (5)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |