The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.

Please select the desired protocol below to get the URL.

This URL has Read-Only access.

Statistics
| Branch: | Revision:

main_repo / deps / npm / man / man3 / view.3 @ d46ebffb

History | View | Annotate | Download (3.72 KB)

1
.\" Generated with Ronnjs 0.3.8
2
.\" http://github.com/kapouer/ronnjs/
3
.
4
.TH "NPM\-VIEW" "3" "April 2013" "" ""
5
.
6
.SH "NAME"
7
\fBnpm-view\fR \-\- View registry info
8
.
9
.SH "SYNOPSIS"
10
.
11
.nf
12
npm\.commands\.view(args, [silent,] callback)
13
.
14
.fi
15
.
16
.SH "DESCRIPTION"
17
This command shows data about a package and prints it to the stream
18
referenced by the \fBoutfd\fR config, which defaults to stdout\.
19
.
20
.P
21
The "args" parameter is an ordered list that closely resembles the command\-line
22
usage\. The elements should be ordered such that the first element is
23
the package and version (package@version)\. The version is optional\. After that,
24
the rest of the parameters are fields with optional subfields ("field\.subfield")
25
which can be used to get only the information desired from the registry\.
26
.
27
.P
28
The callback will be passed all of the data returned by the query\.
29
.
30
.P
31
For example, to get the package registry entry for the \fBconnect\fR package,
32
you can do this:
33
.
34
.IP "" 4
35
.
36
.nf
37
npm\.commands\.view(["connect"], callback)
38
.
39
.fi
40
.
41
.IP "" 0
42
.
43
.P
44
If no version is specified, "latest" is assumed\.
45
.
46
.P
47
Field names can be specified after the package descriptor\.
48
For example, to show the dependencies of the \fBronn\fR package at version
49
0\.3\.5, you could do the following:
50
.
51
.IP "" 4
52
.
53
.nf
54
npm\.commands\.view(["ronn@0\.3\.5", "dependencies"], callback)
55
.
56
.fi
57
.
58
.IP "" 0
59
.
60
.P
61
You can view child field by separating them with a period\.
62
To view the git repository URL for the latest version of npm, you could
63
do this:
64
.
65
.IP "" 4
66
.
67
.nf
68
npm\.commands\.view(["npm", "repository\.url"], callback)
69
.
70
.fi
71
.
72
.IP "" 0
73
.
74
.P
75
For fields that are arrays, requesting a non\-numeric field will return
76
all of the values from the objects in the list\.  For example, to get all
77
the contributor names for the "express" project, you can do this:
78
.
79
.IP "" 4
80
.
81
.nf
82
npm\.commands\.view(["express", "contributors\.email"], callback)
83
.
84
.fi
85
.
86
.IP "" 0
87
.
88
.P
89
You may also use numeric indices in square braces to specifically select
90
an item in an array field\.  To just get the email address of the first
91
contributor in the list, you can do this:
92
.
93
.IP "" 4
94
.
95
.nf
96
npm\.commands\.view(["express", "contributors[0]\.email"], callback)
97
.
98
.fi
99
.
100
.IP "" 0
101
.
102
.P
103
Multiple fields may be specified, and will be printed one after another\.
104
For exampls, to get all the contributor names and email addresses, you
105
can do this:
106
.
107
.IP "" 4
108
.
109
.nf
110
npm\.commands\.view(["express", "contributors\.name", "contributors\.email"], callback)
111
.
112
.fi
113
.
114
.IP "" 0
115
.
116
.P
117
"Person" fields are shown as a string if they would be shown as an
118
object\.  So, for example, this will show the list of npm contributors in
119
the shortened string format\.  (See \fBnpm help json\fR for more on this\.)
120
.
121
.IP "" 4
122
.
123
.nf
124
npm\.commands\.view(["npm", "contributors"], callback)
125
.
126
.fi
127
.
128
.IP "" 0
129
.
130
.P
131
If a version range is provided, then data will be printed for every
132
matching version of the package\.  This will show which version of jsdom
133
was required by each matching version of yui3:
134
.
135
.IP "" 4
136
.
137
.nf
138
npm\.commands\.view(["yui3@\'>0\.5\.4\'", "dependencies\.jsdom"], callback)
139
.
140
.fi
141
.
142
.IP "" 0
143
.
144
.SH "OUTPUT"
145
If only a single string field for a single version is output, then it
146
will not be colorized or quoted, so as to enable piping the output to
147
another command\.
148
.
149
.P
150
If the version range matches multiple versions, than each printed value
151
will be prefixed with the version it applies to\.
152
.
153
.P
154
If multiple fields are requested, than each of them are prefixed with
155
the field name\.
156
.
157
.P
158
Console output can be disabled by setting the \'silent\' parameter to true\.
159
.
160
.SH "RETURN VALUE"
161
The data returned will be an object in this formation:
162
.
163
.IP "" 4
164
.
165
.nf
166
{ <version>:
167
  { <field>: <value>
168
  , \.\.\. }
169
, \.\.\. }
170
.
171
.fi
172
.
173
.IP "" 0
174
.
175
.P
176
corresponding to the list of fields selected\.