NPM-VIEW(3)
π NAME π
okay so hi bestie, welcome to the NPM-VIEW(3) page for npm-view β the command that shows you registry info. Like the NAME says: View registry info. Thatβs literally the whole vibe. π
β¨ SYNOPSIS β¨
npm.commands.view(args, [silent,] callback)
πΈ DESCRIPTION πΈ
This command shows data about a package and prints it to the stream referenced by the outfd config. That config defaults to stdout, so yeah, normally it lands right in your terminal. β¨
The args parameter is an ordered list that closely resembles command-line usage. Order matters, bestie: the first element is the package and version (package@version). The version is optional. After that, the rest of the parameters are fields with optional subfields ("field.subfield") that can be used to get only the info you want from the registry. π₯
The callback will be passed all of the data returned by the query. π«Ά
Example time. To get the package registry entry for the connect package, do this:
npm.commands.view(["connect"], callback)
If no version is specified, "latest" is assumed. Iconic default behavior.
Field names can be specified after the package descriptor. For example, to show the dependencies of the ronn package at version 0.3.5, you could do:
npm.commands.view(["ronn@0.3.5", "dependencies"], callback)
You can view a child field by separating them with a period. To view the git repository URL for the latest version of npm, do:
npm.commands.view(["npm", "repository.url"], callback)
For fields that are arrays, requesting a non-numeric field will return all of the values from the objects in the list. For example, to get all the contributor names for the "express" project, do:
npm.commands.view(["express", "contributors.email"], callback)
You may also use numeric indices in square braces to specifically select an item in an array field. To just get the email address of the first contributor in the list, do:
npm.commands.view(["express", "contributors[0].email"], callback)
Multiple fields may be specified, and will be printed one after another. For example, to get all the contributor names and email addresses, do:
npm.commands.view(["express", "contributors.name", "contributors.email"], callback)
"Person" fields are shown as a string if they would be shown as an object. So for example, this will show the list of npm contributors in the shortened string format. (See npm help json for more on this.)
npm.commands.view(["npm", "contributors"], callback)
If a version range is provided, then data will be printed for every matching version of the package. This will show which version of jsdom was required by each matching version of yui3:
npm.commands.view(["yui3@>0.5.4", "dependencies.jsdom"], callback)
π OUTPUT π
- Single string field, single version: if only a single string field for a single version is output, it will not be colorized or quoted, so as to enable piping the output to another command. Piping queen behavior. π
- Version range matching multiple versions: each printed value will be prefixed with the version it applies to.
- Multiple fields requested: each of them is prefixed with the field name.
- Quiet mode: console output can be disabled by setting the
'silent'parameter totrue.
π¦ RETURN VALUE π¦
The data returned will be an object in this formation:
{ <version>:
{ <field>: <value>
, ... }
, ... }
It corresponds to the list of fields selected. Slay.
cute lil sign-off: this NPM-VIEW(3) page is dated March 2017. periodt. π
π¦ where this page comes from
- nixos 26.05: hueadm 1.2.1
- nixpkgs unstable: hueadm 1.2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms