time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

README.md (2034B)


      1 <!--
      2 
      3 @license Apache-2.0
      4 
      5 Copyright (c) 2018 The Stdlib Authors.
      6 
      7 Licensed under the Apache License, Version 2.0 (the "License");
      8 you may not use this file except in compliance with the License.
      9 You may obtain a copy of the License at
     10 
     11    http://www.apache.org/licenses/LICENSE-2.0
     12 
     13 Unless required by applicable law or agreed to in writing, software
     14 distributed under the License is distributed on an "AS IS" BASIS,
     15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 See the License for the specific language governing permissions and
     17 limitations under the License.
     18 
     19 -->
     20 
     21 # Standard Error
     22 
     23 > [Standard error][standard-streams].
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var stderr = require( '@stdlib/streams/node/stderr' );
     31 ```
     32 
     33 #### stderr
     34 
     35 [Standard error][standard-streams] as a [Writable stream][writable-stream].
     36 
     37 ```javascript
     38 // Write to the terminal...
     39 stderr.write( 'Oh no!', 'utf8' );
     40 // e.g., => 'Oh no!'
     41 ```
     42 
     43 </section>
     44 
     45 <!-- /.usage -->
     46 
     47 <section class="notes">
     48 
     49 ## Notes
     50 
     51 -   Unlike other streams, `stderr` can **never** be closed and, thus, never emits a `'finish'` event.
     52 -   Although rare, writes can block when output is redirected to a file. 
     53 
     54 </section>
     55 
     56 <!-- /.notes -->
     57 
     58 <section class="examples">
     59 
     60 ## Examples
     61 
     62 <!-- run-disable -->
     63 
     64 <!-- eslint no-undef: "error" -->
     65 
     66 ```javascript
     67 var proc = require( 'process' );
     68 var stdin = require( '@stdlib/streams/node/stdin' );
     69 var stderr = require( '@stdlib/streams/node/stderr' );
     70 
     71 // Set the encoding:
     72 stdin.setEncoding( 'utf8' );
     73 
     74 // Create an echo stream:
     75 stdin.pipe( stderr );
     76 
     77 // Push data to `stdin`:
     78 stdin.push( 'beep' );
     79 stdin.push( ' ' );
     80 stdin.push( 'boop' );
     81 stdin.push( '\n' );
     82 
     83 // End the stream:
     84 stdin.push( null );
     85 
     86 // Ensure the process closes:
     87 setTimeout( proc.exit, 1000 );
     88 ```
     89 
     90 </section>
     91 
     92 <!-- /.examples -->
     93 
     94 <section class="links">
     95 
     96 [standard-streams]: https://en.wikipedia.org/wiki/Standard_streams
     97 
     98 [writable-stream]: https://nodejs.org/api/stream.html#stream_class_stream_writable
     99 
    100 </section>
    101 
    102 <!-- /.links -->