← All procedures
npm.view
Read the fields of a package of the npm registry: data has the JSON of npm view
CLI- Package
- @procedures/npm · README
- Path
["npm","view"]- CLI
mark npm view --package <string>- As data
{"$proc":["npm","view"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/npm/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["npm","view"], { package: "<package>" });
console.log(JSON.stringify(result));From the command line
$ mark npm view --package <string>
As data, in a program
{ "$proc": ["npm", "view"], "input": { "package": "<package>" } }Input
Output
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"package": {
"type": "string",
"description": "The package, for example zod, @scope/name or zod@4"
},
"fields": {
"description": "The fields, for example version, dist-tags or versions (default: all)",
"type": "array",
"items": {
"type": "string"
}
},
"registry": {
"description": "The URL of the registry (default: the registry of the npm configuration)",
"type": "string"
},
"cwd": {
"description": "Working directory",
"type": "string"
},
"timeout": {
"description": "Timeout in milliseconds",
"type": "number"
}
},
"required": [
"package"
]
},
"output": {
"type": "object",
"properties": {
"exitCode": {
"type": "number",
"description": "The exit code of npm (0 is success)"
},
"stdout": {
"type": "string",
"description": "The standard output of npm"
},
"stderr": {
"type": "string",
"description": "The standard error of npm, or the error message when npm did not start"
},
"success": {
"type": "boolean",
"description": "True when the exit code is 0"
},
"duration": {
"type": "number",
"description": "The time of the command, in milliseconds"
},
"data": {
"description": "The parsed JSON of the standard output, when it is JSON"
}
},
"required": [
"exitCode",
"stdout",
"stderr",
"success",
"duration"
],
"additionalProperties": {}
}
}