You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

brout

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brout

stdout and stderr for browsers

1.3.0
latest
Source
npmnpm
Version published
Weekly downloads
4.8K
25.91%
Maintainers
1
Weekly downloads
 
Created
Source

stdout and stderr for browsers

Installs process.stdout and process.stderr and redirects console like node.

Repository: https://github.com/mantoni/brout.js

Install with npm

npm install brout

Usage

Assume my-script.js contains this:

process.stdout.write('Hello stdout!\n');
console.log('Hello %s!', 'console');

Use with browserify and phantomic:

$ browserify -t brout my-script.js | phantomic
Hello stdout!
Hello console!

API

var brout = require('brout');

brout.on('out', function (str)) {
  // ...
});

brout.on('err', function (str)) {
  // ...
});

brout.on('exit', function (code)) {
  // ...
});

Event listeners are tiggered by these calls:

  • process.stdout.write(string)
  • process.stderr.write(string)
  • process.exit(code)

The console functions log, info, warn and error get replaced and the original implementation is exposed:

  • console.log.original
  • console.info.original
  • console.warn.original
  • console.error.original

The console override behaves like node's implementation and writes to process.stdout and process.sterr.

If an out or err listener is installed, then the corresponding console message is no longer forwarded to the original console implementation.

License

MIT

Keywords

stdout

FAQs

Package last updated on 09 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.