Gathering detailed insights and metrics for @yorganci/npm-registry-api
Gathering detailed insights and metrics for @yorganci/npm-registry-api
Fully typesafe npm registry API client with optional caching.
npm install @yorganci/npm-registry-api
Typescript
Module System
Node Version
NPM Version
67.1
Supply Chain
96.6
Quality
79.3
Maintenance
100
Vulnerability
100
License
TypeScript (98.52%)
Just (1.48%)
Total Downloads
674
Last Day
4
Last Week
19
Last Month
44
Last Year
674
773 Commits
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
0.3.0
Package Id
@yorganci/npm-registry-api@0.3.0
Unpacked Size
768.98 kB
Size
51.63 kB
File Count
13
NPM Version
10.7.0
Node Version
20.15.1
Publised On
27 Jul 2024
Cumulative downloads
Total Downloads
Last day
0%
4
Compared to previous day
Last week
533.3%
19
Compared to previous week
Last month
266.7%
44
Compared to previous month
Last year
0%
674
Compared to previous year
@yorganci/npm-registry-api
is a fully typesafe npm registry API client with optional caching.
zod
.unstorage
.ohash
docs for serializing cache keys.unstorage
drivers for caching layer.Install @yorganci/npm-registry-api
npm package:
1# yarn 2yarn add @yorganci/npm-registry-api 3 4# npm 5npm install @yorganci/npm-registry-api 6 7# pnpm 8pnpm add @yorganci/npm-registry-api
Basic usage
1import { Client } from "@yorganci/npm-registry-api"; 2 3const client = new Client(); 4 5await client.searchPackages({ text: "react", size: 1 });
Function Name | Description |
---|---|
getAbbreviatedPackument | Fetches abbreviated packument (package document) containing only the metadata necessary to install a package. |
getBulkDailyPackageDownloads | Retrieves the total number of downloads for each day for some packages in the given time period. |
getBulkPackageDownloads | Fetches the total number of downloads for the given packages in the given time period. |
getDailyPackageDownloads | Retrieves the total number of downloads for each day for a package in the given time period. |
getDailyRegistryDownloads | Gets the total number of downloads for each day for all packages in the registry in the given time period. |
getPackageDownloads | Fetches total number of downloads for a package in the given time period. |
getPackageManifest | Retrieves the manifest describing a specific version of a package (e.g., foo@1.0.0 ). |
getPackageVersionsDownloads | Gets the total number of downloads for each version of a package in the previous 7 days. |
getPackument | Fetches full packument (package document) containing all the metadata available about a package. |
getRegistryDownloads | Retrieves total number of downloads for all packages in the registry in the given time period. |
getRegistryMetadata | Fetches metadata describing the registry itself. |
getRegistrySigningKeys | Retrieves public signing keys used by the registry. |
searchPackages | Searches packages corresponding to a given query. |
@yorganci/npm-registry-api/cache
module provides basic factory function to create Cache
object to be used by Client
. By default createCache
, uses ohash
under the hood to generate cache keys from URL and HTTP headers and any Driver
implementation from unstorage
can be used for persistance the default is unstorage/drivers/memory
.
Basic usage with default options.
1import { Client } from "@yorganci/npm-registry-api"; 2import { createCache } from "@yorganci/npm-registry-api/cache"; 3 4// By default `Map<string, unknown>` is used as caching layer 5const cachedClient = new Client({ 6 cache: createCache(), 7});
Create a file-system backed cache client.
1import { Client } from "@yorganci/npm-registry-api"; 2import { createCache } from "@yorganci/npm-registry-api/cache"; 3import fs from "unstorage/drivers/fs"; 4 5const cachedClient = new Client({ 6 cache: createCache({ 7 storage: fs({ 8 base: "./data", 9 }), 10 }), 11});
No vulnerabilities found.
No security vulnerabilities found.