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

apt-client-idolize

v2.2.0

Published

A library for reading aptly repositories

Downloads

4

Readme

Apt-Client

A basic Apt client for node and the browser, so you can get information about debian packages.

  • new AptClient(sources?: string[], arch?: string, cachetime? number) Constructs a new client for a possibly-empty list of source and optionally-specified architecture (defaults to 'all'). The sources should be strings just like you would see in a sources.list file, one per line. If cachetime is specified, client.update will avoid re-requesting data for particular sources if they have already been requested within the last cachetime milliseconds.

  • client.update(sources?: string[], arch?: string, cachetime? number, clear?: boolean): Promise<void> Rewrites the local cache with data fetched from the specified sources. The first three arguments default to the values provided to the constructor. This allows you the flexibility to specify a source list, target architecture, or cache timeout at client-creation, or at update time. The clear parameter specifies whether the cached package data should be totally replace, or only updated--the latter is useful if you wish to re-request a specific source without wiping out cached data previously requested from other sources. This defaults to true.

  • client.getPackages(): { bin: string[], src: string[] } Returns lists of the names of all packages available as binaries or source.

  • client.listVersions(pkgName: string): { bin: string[], src: string[] } For a given package name, returns all of the versions available in binary or source formats.

  • client.getPkgInfo(pkgNames: Iterable<string>): Promise<{ bin: Map<string, PkgInfo<BinPkgInfo>>, src: Map<string, PkgInfo<SrcPkgInfo>> }> Gets detailed information about the named packages.

  • client.getBinFiles(pkgNames: Iterable<string>): Promise<Map<string, ArrayBuffer>> Gets the binary .deb files for a list of packages as ArrayBuffers.

  • client.getSrcFiles(pkgNames: Iterable<string>): Promise<Map<string, { [key: string]: ArrayBuffer;}>> Gets the source files for a list of packages, with the sources of each package provided as an object mapping from source file name to ArrayBuffer.

  • client.isLatest(pkgName: string, version: string): boolean Checks if a given package version is the latest. Defaults to true if the package is not found in the cached sources. Checks against binary packages first, and source versions if the binary does not exist.

  • client.areLatest(packages: Iterable<[pkgName: string, version: string]>): Generator<[string, boolean]> Checks if each package is at the latest version, with the same algorithm as client.isLatest.

  • client.getLatest(packages: Iterable<string>): Generator<[pkgName: string, version: string]> Gets the latest version of each package available as a binary, or as a source if no binaries are available.

  • client.areAllLatest(packages: Iterable<[pkgName: string, version: string]>): boolean Checks if all the requested packages are up to date; this is more efficient than client.areLatest due to short-circuiting on the first non-up-to-date package.

  • AptClient.cmpVersions(a: string, b: string): number Compares two Debian package version strings and returns < 0 if a is less than b, > 0 if a is greater than b, and 0 if a equals b.

  • type PkgInfo<T> { latest: string, versions: Map<string, T> } For a given package, caches the latest version available and provides a map from version numbers to more detailed information about that package version.

Data guaranteed to be available on all package version info objects includes:

  • Package: string The package name
  • RepoBase: string The URL to the repository from which this information was obtained.
  • Version: string The version of the package being described.
  • Maintainer: { name: string, email: string} Contact information for the package maintainer.

Additional data guaranteed to be available on all version objects for binary packages includes:

  • Architecture: string[] A list of architectures for which binaries are available.
  • InstalledSize: number
  • Description: string
  • Filename: string A relative URL specifying where the binary file is stored in the repository.
  • Size: number

Additional data guaranteed to be available on all version objects for source packages includes:

  • Directory: string A relative URL specifying the directory in which source files are stored in the repository.
  • Files: { name: string, hash: string, size: number }[] A list of objects describing the individual source files.

Numerous other optional fields may or may not be present depending on their presence in the specific repository being queried.