Skip to content

Commit

Permalink
Site updated at 2024-01-21 08:52:46 UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
icai committed Jan 21, 2024
1 parent 1bb15a7 commit 4a2ce9f
Show file tree
Hide file tree
Showing 62 changed files with 7,218 additions and 3,122 deletions.

Large diffs are not rendered by default.

81 changes: 41 additions & 40 deletions node/addons.html

Large diffs are not rendered by default.

204 changes: 96 additions & 108 deletions node/assert.html

Large diffs are not rendered by default.

66 changes: 50 additions & 16 deletions node/async_context.html

Large diffs are not rendered by default.

100 changes: 72 additions & 28 deletions node/async_hooks.html

Large diffs are not rendered by default.

92 changes: 75 additions & 17 deletions node/buffer.html

Large diffs are not rendered by default.

105 changes: 55 additions & 50 deletions node/child_process.html

Large diffs are not rendered by default.

497 changes: 352 additions & 145 deletions node/cli.html

Large diffs are not rendered by default.

64 changes: 35 additions & 29 deletions node/cluster.html

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions node/console.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<link rel="canonical" href="https://docs.w3cub.com/node/console.html">
<link href="/favicon.png" rel="icon">
<link rel="stylesheet" type="text/css" href="/assets/application-9c7b0d969c0ce639a6c01c2badcdd81667c7c66206aa3d0fccc5cb0585fb1b912dab72ea882101d18010680927514b4b77b107282db8f756fbf63301fe9c88b0.css">
<link rel="stylesheet" type="text/css" href="/assets/application-c8f743fc70bb84079c3cf4b71f5f99835529659c30689b2fd6193651a680f383ef1d96896f8966c7ca8a0160ffd557685bb8ad12820ec6002d60143812238086.css">
<script type="text/javascript" src="/assets/application-79c555f6b25481fffac2cac30a7f3e54e608ca09e9e8e42bb1790095ba6d0fcace47d6bc624ddce952c70370892f2d46864f89e6943d4f7f7ff16c8a3231a91a.js"></script>
<script src="/json/node.js"></script>

Expand Down Expand Up @@ -89,7 +89,7 @@ <h2 id="console">Console
</h2>
<div class="api_stability api_stability_2">
<a href="https://nodejs.org/api/documentation.html#stability-index">Stability: 2</a> - Stable</div>
<p><strong>Source Code:</strong> <a href="https://github.com/nodejs/node/blob/v19.0.1/lib/console.js">lib/console.js</a></p> <p>The <code>node:console</code> module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.</p> <p>The module exports two specific components:</p> <ul> <li>A <code>Console</code> class with methods such as <code>console.log()</code>, <code>console.error()</code>, and <code>console.warn()</code> that can be used to write to any Node.js stream.</li> <li>A global <code>console</code> instance configured to write to <a href="process#processstdout"><code>process.stdout</code></a> and <a href="process#processstderr"><code>process.stderr</code></a>. The global <code>console</code> can be used without calling <code>require('node:console')</code>.</li> </ul> <p><em><strong>Warning</strong></em>: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the <a href="process#a-note-on-process-io">note on process I/O</a> for more information.</p> <p>Example using the global <code>console</code>:</p> <pre data-language="js">console.log('hello world');
<p><strong>Source Code:</strong> <a href="https://github.com/nodejs/node/blob/v20.8.0/lib/console.js">lib/console.js</a></p> <p>The <code>node:console</code> module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.</p> <p>The module exports two specific components:</p> <ul> <li>A <code>Console</code> class with methods such as <code>console.log()</code>, <code>console.error()</code>, and <code>console.warn()</code> that can be used to write to any Node.js stream.</li> <li>A global <code>console</code> instance configured to write to <a href="process#processstdout"><code>process.stdout</code></a> and <a href="process#processstderr"><code>process.stderr</code></a>. The global <code>console</code> can be used without calling <code>require('node:console')</code>.</li> </ul> <p><em><strong>Warning</strong></em>: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the <a href="process#a-note-on-process-io">note on process I/O</a> for more information.</p> <p>Example using the global <code>console</code>:</p> <pre data-language="js">console.log('hello world');
// Prints: hello world, to stdout
console.log('hello %s', 'world');
// Prints: hello world, to stdout
Expand All @@ -106,7 +106,7 @@ <h2 id="console">Console

const name = 'Will Robinson';
console.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to stderr</pre> <p>Example using the <code>Console</code> class:</p> <pre data-language="js">const out = getStreamSomehow();
// Prints: Danger Will Robinson! Danger!, to stderr copy</pre> <p>Example using the <code>Console</code> class:</p> <pre data-language="js">const out = getStreamSomehow();
const err = getStreamSomehow();
const myConsole = new console.Console(out, err);

Expand All @@ -119,15 +119,15 @@ <h2 id="console">Console

const name = 'Will Robinson';
myConsole.warn(`Danger ${name}! Danger!`);
// Prints: Danger Will Robinson! Danger!, to err</pre> <section><h3 id="class-console">Class: <code>Console</code>
// Prints: Danger Will Robinson! Danger!, to err copy</pre> <section><h3 id="class-console">Class: <code>Console</code>
</h3> <div class="api_metadata"> <details class="changelog"><summary>History</summary> <table> <tbody>
<tr>
<th>Version</th>
<th>Changes</th>
</tr> <tr>
<td>v8.0.0</td> <td><p>Errors that occur while writing to the underlying streams will now be ignored by default.</p></td>
</tr> </tbody>
</table> </details> </div> <p>The <code>Console</code> class can be used to create a simple logger with configurable output streams and can be accessed using either <code>require('node:console').Console</code> or <code>console.Console</code> (or their destructured counterparts):</p> <pre data-language="js">const { Console } = require('node:console');</pre> <pre data-language="js">const { Console } = console;</pre> <h4 id="new-consolestdout-stderr-ignoreerrors">
</table> </details> </div> <p>The <code>Console</code> class can be used to create a simple logger with configurable output streams and can be accessed using either <code>require('node:console').Console</code> or <code>console.Console</code> (or their destructured counterparts):</p> <pre data-language="js">const { Console } = require('node:console'); copy</pre> <pre data-language="js">const { Console } = console; copy</pre> <h4 id="new-consolestdout-stderr-ignoreerrors">
<code>new Console(stdout[, stderr][, ignoreErrors])</code>
</h4> <h4 id="new-consoleoptions">
<code>new Console(options)</code>
Expand Down Expand Up @@ -160,7 +160,7 @@ <h2 id="console">Console
// use it like console
const count = 5;
logger.log('count: %d', count);
// In stdout.log: count 5</pre> <p>The global <code>console</code> is a special <code>Console</code> whose output is sent to <a href="process#processstdout"><code>process.stdout</code></a> and <a href="process#processstderr"><code>process.stderr</code></a>. It is equivalent to calling:</p> <pre data-language="js">new Console({ stdout: process.stdout, stderr: process.stderr });</pre> <h4 id="consoleassertvalue-message">
// In stdout.log: count 5 copy</pre> <p>The global <code>console</code> is a special <code>Console</code> whose output is sent to <a href="process#processstdout"><code>process.stdout</code></a> and <a href="process#processstderr"><code>process.stderr</code></a>. It is equivalent to calling:</p> <pre data-language="js">new Console({ stdout: process.stdout, stderr: process.stderr }); copy</pre> <h4 id="consoleassertvalue-message">
<code>console.assert(value[, ...message])</code>
</h4> <div class="api_metadata"> <details class="changelog"><summary>History</summary> <table> <tbody>
<tr>
Expand All @@ -179,7 +179,7 @@ <h2 id="console">Console
// Assertion failed: Whoops didn't work

console.assert();
// Assertion failed</pre> <h4 id="consoleclear">
// Assertion failed copy</pre> <h4 id="consoleclear">
<code>console.clear()</code>
</h4> <div class="api_metadata"> <span>Added in: v8.3.0</span> </div> <p>When <code>stdout</code> is a TTY, calling <code>console.clear()</code> will attempt to clear the TTY. When <code>stdout</code> is not a TTY, this method does nothing.</p> <p>The specific operation of <code>console.clear()</code> can vary across operating systems and terminal types. For most Linux operating systems, <code>console.clear()</code> operates similarly to the <code>clear</code> shell command. On Windows, <code>console.clear()</code> will clear only the output in the current terminal viewport for the Node.js binary.</p> <h4 id="consolecountlabel">
<code>console.count([label])</code>
Expand All @@ -202,7 +202,7 @@ <h2 id="console">Console
&gt; console.count()
default: 3
undefined
&gt;</pre> <h4 id="consolecountresetlabel">
&gt; copy</pre> <h4 id="consolecountresetlabel">
<code>console.countReset([label])</code>
</h4> <div class="api_metadata"> <span>Added in: v8.3.0</span> </div> <ul> <li>
<code>label</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a> The display label for the counter. <strong>Default:</strong> <code>'default'</code>.</li> </ul> <p>Resets the internal counter specific to <code>label</code>.</p> <pre data-language="js">&gt; console.count('abc');
Expand All @@ -213,7 +213,7 @@ <h2 id="console">Console
&gt; console.count('abc');
abc: 1
undefined
&gt;</pre> <h4 id="consoledebugdata-args">
&gt; copy</pre> <h4 id="consoledebugdata-args">
<code>console.debug(data[, ...args])</code>
</h4> <div class="api_metadata"> <details class="changelog"><summary>History</summary> <table> <tbody>
<tr>
Expand Down Expand Up @@ -259,7 +259,7 @@ <h2 id="console">Console
console.error('error #%d', code);
// Prints: error #5, to stderr
console.error('error', code);
// Prints: error 5, to stderr</pre> <p>If formatting elements (e.g. <code>%d</code>) are not found in the first string then <a href="util#utilinspectobject-options"><code>util.inspect()</code></a> is called on each argument and the resulting string values are concatenated. See <a href="util#utilformatformat-args"><code>util.format()</code></a> for more information.</p> <h4 id="consolegrouplabel">
// Prints: error 5, to stderr copy</pre> <p>If formatting elements (e.g. <code>%d</code>) are not found in the first string then <a href="util#utilinspectobject-options"><code>util.inspect()</code></a> is called on each argument and the resulting string values are concatenated. See <a href="util#utilformatformat-args"><code>util.format()</code></a> for more information.</p> <h4 id="consolegrouplabel">
<code>console.group([...label])</code>
</h4> <div class="api_metadata"> <span>Added in: v8.5.0</span> </div> <ul> <li>
<code>...label</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types" class="type">&lt;any&gt;</a>
Expand All @@ -283,7 +283,7 @@ <h2 id="console">Console
console.log('count: %d', count);
// Prints: count: 5, to stdout
console.log('count:', count);
// Prints: count: 5, to stdout</pre> <p>See <a href="util#utilformatformat-args"><code>util.format()</code></a> for more information.</p> <h4 id="consoletabletabulardata-properties">
// Prints: count: 5, to stdout copy</pre> <p>See <a href="util#utilformatformat-args"><code>util.format()</code></a> for more information.</p> <h4 id="consoletabletabulardata-properties">
<code>console.table(tabularData[, properties])</code>
</h4> <div class="api_metadata"> <span>Added in: v10.0.0</span> </div> <ul> <li>
<code>tabularData</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types" class="type">&lt;any&gt;</a>
Expand All @@ -309,7 +309,7 @@ <h2 id="console">Console
// ├─────────┼─────┤
// │ 0 │ 1 │
// │ 1 │ 'Z' │
// └─────────┴─────┘</pre> <h4 id="consoletimelabel">
// └─────────┴─────┘ copy</pre> <h4 id="consoletimelabel">
<code>console.time([label])</code>
</h4> <div class="api_metadata"> <span>Added in: v0.1.104</span> </div> <ul> <li>
<code>label</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a> <strong>Default:</strong> <code>'default'</code>
Expand All @@ -331,7 +331,7 @@ <h2 id="console">Console
</li> </ul> <p>Stops a timer that was previously started by calling <a href="#consoletimelabel"><code>console.time()</code></a> and prints the result to <code>stdout</code>:</p> <pre data-language="js">console.time('bunch-of-stuff');
// Do a bunch of stuff.
console.timeEnd('bunch-of-stuff');
// Prints: bunch-of-stuff: 225.438ms</pre> <h4 id="consoletimeloglabel-data">
// Prints: bunch-of-stuff: 225.438ms copy</pre> <h4 id="consoletimeloglabel-data">
<code>console.timeLog([label][, ...data])</code>
</h4> <div class="api_metadata"> <span>Added in: v10.7.0</span> </div> <ul> <li>
<code>label</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a> <strong>Default:</strong> <code>'default'</code>
Expand All @@ -342,7 +342,7 @@ <h2 id="console">Console
console.timeLog('process', value);
// Prints "process: 365.227ms 42".
doExpensiveProcess2(value);
console.timeEnd('process');</pre> <h4 id="consoletracemessage-args">
console.timeEnd('process'); copy</pre> <h4 id="consoletracemessage-args">
<code>console.trace([message][, ...args])</code>
</h4> <div class="api_metadata"> <span>Added in: v0.1.104</span> </div> <ul> <li>
<code>message</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types" class="type">&lt;any&gt;</a>
Expand All @@ -360,7 +360,7 @@ <h2 id="console">Console
// at REPLServer.emit (events.js:169:7)
// at REPLServer.Interface._onLine (readline.js:210:10)
// at REPLServer.Interface._line (readline.js:549:8)
// at REPLServer.Interface._ttyWrite (readline.js:826:14)</pre> <h4 id="consolewarndata-args">
// at REPLServer.Interface._ttyWrite (readline.js:826:14) copy</pre> <h4 id="consolewarndata-args">
<code>console.warn([data][, ...args])</code>
</h4> <div class="api_metadata"> <span>Added in: v0.1.100</span> </div> <ul> <li>
<code>data</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types" class="type">&lt;any&gt;</a>
Expand All @@ -374,7 +374,7 @@ <h2 id="console">Console
</li> </ul> <p>This method does not display anything unless used in the inspector. The <code>console.profile()</code> method starts a JavaScript CPU profile with an optional label until <a href="#consoleprofileendlabel"><code>console.profileEnd()</code></a> is called. The profile is then added to the <strong>Profile</strong> panel of the inspector.</p> <pre data-language="js">console.profile('MyLabel');
// Some code
console.profileEnd('MyLabel');
// Adds the profile 'MyLabel' to the Profiles panel of the inspector.</pre> <h4 id="consoleprofileendlabel">
// Adds the profile 'MyLabel' to the Profiles panel of the inspector. copy</pre> <h4 id="consoleprofileendlabel">
<code>console.profileEnd([label])</code>
</h4> <div class="api_metadata"> <span>Added in: v8.0.0</span> </div> <ul> <li>
<code>label</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a>
Expand Down
Loading

0 comments on commit 4a2ce9f

Please sign in to comment.