updated docs

This commit is contained in:
Sebastian Hildebrandt 2020-08-25 10:50:11 +02:00
parent 0e49210f00
commit 0a334fda63
2 changed files with 10 additions and 9 deletions

View File

@ -58,7 +58,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
| 4.23.6 | 2020-04-25 | `networkGatewayDefault()` bug fix no interfaces |
| 4.23.5 | 2020-04-20 | updated docs |
| 4.23.4 | 2020-04-20 | `users()` optimized parseDateTime function |
| 4.23.3 | 2020-04-09 | recactored to avoid `cat` |
| 4.23.3 | 2020-04-09 | refactored to avoid `cat` |
| 4.23.2 | 2020-04-08 | `cpu()` fixed getting base frequency for AMD Ryzen |
| 4.23.1 | 2020-03-11 | `diskLayout()` optimized detection linux |
| 4.23.0 | 2020-03-08 | `versions()` added param to specify which program/lib versions to detect |

View File

@ -92,10 +92,11 @@ si.cpu(function(data) {
console.log('...');
})</code></pre><br>
<p><strong>Promise Style</strong></p>
<p>Promises style is new since version 3.0.<p></p>
<p>Promises style is new since version 3.0.
<p></p>
<p>When omitting callback parameter (cb), then you can use all function in a promise oriented way. All functions (exept of <span class="code">version</span> and <span class="code">time</span>) are returning a promise, that you can consume:</p>
<pre><code class="js">const si = require('systeminformation');
<p>When omitting callback parameter (cb), then you can use all function in a promise oriented way. All functions (exept of <span class="code">version</span> and <span class="code">time</span>) are returning a promise, that you can consume:</p>
<pre><code class="js">const si = require('systeminformation');
si.cpu()
.then(data => {
@ -108,9 +109,9 @@ si.cpu()
console.log('...');
})
.catch(error => console.error(error));</code></pre><br>
<p><strong>Async/Await Style</strong></p>
<p>Since node v7.6 you can also use the async / await pattern. The above example would then look like this:</p>
<pre><code class="js">const si = require('systeminformation');
<p><strong>Async/Await Style</strong></p>
<p>Since node v7.6 you can also use the async / await pattern. The above example would then look like this:</p>
<pre><code class="js">const si = require('systeminformation');
async function cpuData() {
try {
@ -126,8 +127,8 @@ async function cpuData() {
console.log(e)
}
}</code></pre><br>
<p><strong>Issues</strong></p>
<p>If you discover some empty or incorrect values, please be sure to first have a look at the <a href="issues.html">Known issues</a> section.</p>
<p><strong>Issues</strong></p>
<p>If you discover some empty or incorrect values, please be sure to first have a look at the <a href="issues.html">Known issues</a> section.</p>
</div>
</div>
</div>