updated docs

This commit is contained in:
Sebastian Hildebrandt 2020-05-07 10:49:39 +02:00
parent e44e13e3c6
commit bcdbf99012

View File

@ -46,7 +46,7 @@
<div class="col-12 sectionheader">
<div class="title">General</div>
<div class="text">
<p>In this section you will learn how to get general systeminformation data. We will also cover the "get-all" functions to get all data at once.</p>
<p>In this section you will learn how to get general systeminformation data. We will also cover the "get" and "get-all" functions to get partial or all data with one single call.</p>
<p>For function reference and examples we assume, that we imported <span class="code">systeminformation</span> as follows:</p>
<pre><code class="js">const si = require('systeminformation');</code></pre>
<h2>Lib-Version and Time/Timezone</h2>
@ -128,8 +128,9 @@
</tbody>
</table>
<p>Keep in mind, that there is another function <span class="code">si.versions()</span> that will return versions of other system libraries and software packages</p>
<h2>Get All At Once</h2>
<p>The following three functions <span class="code">si.getStaticData()</span>, <span class="code">si.getDynamicData()</span> and <span class="code">si.getAllData()</span> will return most of the available data in a single result object:</p>
<h2>Get Defined Result Object</h2>
<p>Normally you would call each of the functions (where you want to have detailed system information) seperately. The docs pages contain a full reference (with examples) for each available function. But there is also another really handy way to get a self-defined information object in one single call:</p>
<p>The <span class="code">si.get()</span> function is an alternative, where you can obtain several system information data in one call. You can define a json object which represents the data structure you are expecting and the <span class="code">si.get()</span> call will then return all of the requested data in a single result object</p>
<table class="table table-sm table-bordered table-striped">
<thead>
<tr>
@ -143,37 +144,6 @@
<th>Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td>si.getStaticData(cb)</td>
<td>{...}</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>all static data at once</td>
</tr>
<tr>
<td>si.getDynamicData(srv,iface,cb)</td>
<td>{...}</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>all dynamic data at once<br>Specify services and interfaces to monitor<br>Defaults to first external network interface<br>Pass "*" for ALL services (linux/win only)<br>Pass "*" for ALL network interfaces</td>
</tr>
<tr>
<td>si.getAllData(srv,iface,cb)</td>
<td>{...}</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>all data at once<br>Specify services and interfaces to monitor<br>Defaults to first external network interface<br>Pass "*" for ALL services (linux/win only)<br>Pass "*" for ALL network interfaces</td>
</tr>
<tr>
<td>si.get(valueObject,cb)</td>
<td>{...}</td>
@ -182,7 +152,7 @@
<td>X</td>
<td>X</td>
<td>X</td>
<td>get partial data at once<br>Specify return object for all<br>values that should be returned.<br>See example:</td>
<td>get partial data at once<br>Specify return object for all<br>values that should be returned:</td>
</tr>
<tr class="example">
<td></td>
@ -232,6 +202,55 @@ si.get(valueObject).then(data => console.log(data));</code></pre class="example"
</tr>
</tbody>
</table>
<p>The key names of the <span class="code">valueObject</span> must be exactly the same as the representing function within systeminformation.</p>
<h2>Get All At Once</h2>
<p>The following three functions <span class="code">si.getStaticData()</span>, <span class="code">si.getDynamicData()</span> and <span class="code">si.getAllData()</span> will return most of the available data in a single result object:</p>
<table class="table table-sm table-bordered table-striped">
<thead>
<tr>
<th>Function</th>
<th>Result object</th>
<th>Linux</th>
<th>BSD</th>
<th>Mac</th>
<th>Win</th>
<th>Sun</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td>si.getStaticData(cb)</td>
<td>{...}</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>all static data at once</td>
</tr>
<tr>
<td>si.getDynamicData(srv,iface,cb)</td>
<td>{...}</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>all dynamic data at once<br>Specify services and interfaces to monitor<br>Defaults to first external network interface<br>Pass "*" for ALL services (linux/win only)<br>Pass "*" for ALL network interfaces</td>
</tr>
<tr>
<td>si.getAllData(srv,iface,cb)</td>
<td>{...}</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>all data at once<br>Specify services and interfaces to monitor<br>Defaults to first external network interface<br>Pass "*" for ALL services (linux/win only)<br>Pass "*" for ALL network interfaces</td>
</tr>
</tbody>
</table>
<p><strong>Static data</strong> is all hardware related (or more or less constant) data like system, baseboard, bios, OS, versions, cpu, network interfces, memory and disk layout</p>
<p><strong>Dynamic data</strong> will return user, cpu-speed, load, processes, services, temperature, file system, network and disk stats, ... </p>
<p>As not all funtions are supported in each operating system the result object might be different in each OS.</p>