mute

Politely tells stdout and stderr to shut the heck up for a moment.

MIT 7 个版本
安装
npm install mute
yarn add mute
pnpm add mute
bun add mute
README

mute

NPM version Downloads Build Status Coverage Status Chat Tip

Politely tells one or more streams to shut the heck up for a moment by temporarily reassigning their write methods. Useful when testing noisey modules which lack verbosity options. Mutes stdout and stderr by default.

Install

$ npm install --save mute

Usage

var mute = require('mute');

// Mute stdout and stderr
var unmute = mute();

console.log('foo');   // doesn't print 'foo'
console.error('bar'); // doesn't print 'bar'

unmute();

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

// Mute just stderr
var unmuteErr = mute(process.stderr);

console.log('foo');   // prints 'foo'
console.error('bar'); // doesn't print 'bar'

unmuteErr();

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

API

mute(...stream): Function()

Accepts one or more streams or arrays of streams, mutes them all, and returns a function to unmute them.

Test

$ npm test

Contribute

Tasks

Standards for this project, including tests, code coverage, and semantics are enforced with a build tool. Pull requests must include passing tests with 100% code coverage and no linting errors.


© 2015 Shannon Moeller me@shannonmoeller.com

Licensed under MIT

版本列表
2.0.6 2016-02-12
2.0.5 2016-02-12
2.0.4 2016-02-12
2.0.3 2015-12-27
2.0.2 2015-12-27
2.0.1 2015-12-27
1.0.0 2013-11-21