]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/html/doc/api/npm.html
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / html / doc / api / npm.html
1 <!doctype html>
2 <html>
3   <title>npm</title>
4   <meta charset="utf-8">
5   <link rel="stylesheet" type="text/css" href="../../static/style.css">
6   <link rel="canonical" href="https://www.npmjs.org/doc/api/npm.html">
7   <script async=true src="../../static/toc.js"></script>
8
9   <body>
10     <div id="wrapper">
11
12 <h1><a href="../api/npm.html">npm</a></h1> <p>javascript package manager</p>
13 <h2 id="synopsis">SYNOPSIS</h2>
14 <pre><code>var npm = require(&quot;npm&quot;)
15 npm.load([configObject, ]function (er, npm) {
16   // use the npm object, now that it&#39;s loaded.
17
18   npm.config.set(key, val)
19   val = npm.config.get(key)
20
21   console.log(&quot;prefix = %s&quot;, npm.prefix)
22
23   npm.commands.install([&quot;package&quot;], cb)
24 })
25 </code></pre><h2 id="version">VERSION</h2>
26 <p>2.15.11</p>
27 <h2 id="description">DESCRIPTION</h2>
28 <p>This is the API documentation for npm.
29 To find documentation of the command line
30 client, see <code><a href="../cli/npm.html">npm(1)</a></code>.</p>
31 <p>Prior to using npm&#39;s commands, <code>npm.load()</code> must be called.  If you provide
32 <code>configObject</code> as an object map of top-level configs, they override the values
33 stored in the various config locations. In the npm command line client, this
34 set of configs is parsed from the command line options. Additional
35 configuration params are loaded from two configuration files. See
36 <code><a href="../cli/npm-config.html">npm-config(1)</a></code>, <code><a href="../misc/npm-config.html">npm-config(7)</a></code>, and <code><a href="../files/npmrc.html">npmrc(5)</a></code> for more information.</p>
37 <p>After that, each of the functions are accessible in the
38 commands object: <code>npm.commands.&lt;cmd&gt;</code>.  See <code><a href="../misc/npm-index.html">npm-index(7)</a></code> for a list of
39 all possible commands.</p>
40 <p>All commands on the command object take an <strong>array</strong> of positional argument
41 <strong>strings</strong>. The last argument to any function is a callback. Some
42 commands take other optional arguments.</p>
43 <p>Configs cannot currently be set on a per function basis, as each call to
44 npm.config.set will change the value for <em>all</em> npm commands in that process.</p>
45 <p>To find API documentation for a specific command, run the <code>npm apihelp</code>
46 command.</p>
47 <h2 id="methods-and-properties">METHODS AND PROPERTIES</h2>
48 <ul>
49 <li><p><code>npm.load(configs, cb)</code></p>
50 <p>  Load the configuration params, and call the <code>cb</code> function once the
51   globalconfig and userconfig files have been loaded as well, or on
52   nextTick if they&#39;ve already been loaded.</p>
53 </li>
54 <li><p><code>npm.config</code></p>
55 <p>  An object for accessing npm configuration parameters.</p>
56 <ul>
57 <li><code>npm.config.get(key)</code></li>
58 <li><code>npm.config.set(key, val)</code></li>
59 <li><code>npm.config.del(key)</code></li>
60 </ul>
61 </li>
62 <li><p><code>npm.dir</code> or <code>npm.root</code></p>
63 <p>  The <code>node_modules</code> directory where npm will operate.</p>
64 </li>
65 <li><p><code>npm.prefix</code></p>
66 <p>  The prefix where npm is operating.  (Most often the current working
67   directory.)</p>
68 </li>
69 <li><p><code>npm.cache</code></p>
70 <p>  The place where npm keeps JSON and tarballs it fetches from the
71   registry (or uploads to the registry).</p>
72 </li>
73 <li><p><code>npm.tmp</code></p>
74 <p>  npm&#39;s temporary working directory.</p>
75 </li>
76 <li><p><code>npm.deref</code></p>
77 <p>  Get the &quot;real&quot; name for a command that has either an alias or
78   abbreviation.</p>
79 </li>
80 </ul>
81 <h2 id="magic">MAGIC</h2>
82 <p>For each of the methods in the <code>npm.commands</code> object, a method is added to the
83 npm object, which takes a set of positional string arguments rather than an
84 array and a callback.</p>
85 <p>If the last argument is a callback, then it will use the supplied
86 callback.  However, if no callback is provided, then it will print out
87 the error or results.</p>
88 <p>For example, this would work in a node repl:</p>
89 <pre><code>&gt; npm = require(&quot;npm&quot;)
90 &gt; npm.load()  // wait a sec...
91 &gt; npm.install(&quot;dnode&quot;, &quot;express&quot;)
92 </code></pre><p>Note that that <em>won&#39;t</em> work in a node program, since the <code>install</code>
93 method will get called before the configuration load is completed.</p>
94 <h2 id="abbrevs">ABBREVS</h2>
95 <p>In order to support <code>npm ins foo</code> instead of <code>npm install foo</code>, the
96 <code>npm.commands</code> object has a set of abbreviations as well as the full
97 method names.  Use the <code>npm.deref</code> method to find the real name.</p>
98 <p>For example:</p>
99 <pre><code>var cmd = npm.deref(&quot;unp&quot;) // cmd === &quot;unpublish&quot;
100 </code></pre>
101 </div>
102
103 <table border=0 cellspacing=0 cellpadding=0 id=npmlogo>
104 <tr><td style="width:180px;height:10px;background:rgb(237,127,127)" colspan=18>&nbsp;</td></tr>
105 <tr><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td><td style="width:40px;height:10px;background:#fff" colspan=4>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4>&nbsp;</td><td style="width:40px;height:10px;background:#fff" colspan=4>&nbsp;</td><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td><td colspan=6 style="width:60px;height:10px;background:#fff">&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4>&nbsp;</td></tr>
106 <tr><td colspan=2 style="width:20px;height:30px;background:#fff" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:20px;height:10px;background:#fff" rowspan=4 colspan=2>&nbsp;</td><td style="width:10px;height:20px;background:rgb(237,127,127)" rowspan=2>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:20px;height:10px;background:#fff" rowspan=3 colspan=2>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td></tr>
107 <tr><td style="width:10px;height:10px;background:#fff" rowspan=2>&nbsp;</td></tr>
108 <tr><td style="width:10px;height:10px;background:#fff">&nbsp;</td></tr>
109 <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6>&nbsp;</td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td></tr>
110 <tr><td colspan=5 style="width:50px;height:10px;background:#fff">&nbsp;</td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4>&nbsp;</td><td style="width:90px;height:10px;background:#fff" colspan=9>&nbsp;</td></tr>
111 </table>
112 <p id="footer">npm &mdash; npm@2.15.11</p>
113