record-stdstreams
TypeScript icon, indicating that this package has built-in type declarations

3.0.73 • Public • Published

record-stdstreams

record-stdstreams records process.stdout and process.stderr.

Status

Category Status
Version npm
Dependencies David
Dev dependencies David
Build GitHub Actions
License GitHub

Installation

$ npm install record-stdstreams

Quick start

First you need to integrate record-stdstreams into your application.

const { record } = require('record-stdstreams');

If you use TypeScript, use the following code instead:

import { record } from 'record-stdstreams';

To capture output call the record function. It returns a stop function. To stop capturing call this function. The result are the captured stdout and stderr streams.

const stop = record();

console.log('foo');
console.error('bar');

const { stdout, stderr } = stop();

console.log(stdout);
// => 'foo\n'

console.log(stderr);
// => 'bar\n'

Suppressing output during recording

To record the std streams, but suppress their output, call record with false as parameter:

const stop = record(false);

console.log('foo');
// => Does not produce any output.

const { stdout } = stop();

console.log(stdout);
// => 'foo\n'

Running quality assurance

To run quality assurance for this module use roboter:

$ npx roboter

Readme

Keywords

Package Sidebar

Install

npm i record-stdstreams

Weekly Downloads

7

Version

3.0.73

License

MIT

Unpacked Size

32.5 kB

Total Files

12

Last publish

Collaborators

  • thenativeweb-admin
  • goloroden