Socket
Socket
Sign inDemoInstall

browser-stdout

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    browser-stdout

`process.stdout` in your browser.


Version published
Weekly downloads
6.5M
decreased by-0.14%
Maintainers
1
Install size
3.23 kB
Created
Weekly downloads
 

Package description

What is browser-stdout?

The browser-stdout npm package is designed to provide a writable stream for the browser's console, mimicking the behavior of process.stdout in Node.js environments. This is particularly useful for libraries that are designed to work both in Node.js and in the browser, allowing them to write output to the console in a unified way.

What are browser-stdout's main functionalities?

Writable Stream for Console

This code snippet demonstrates how to redirect all console.log outputs to the browser-stdout stream. It creates a writable stream that mimics process.stdout and overrides the default console.log method to use this stream instead.

var stdout = require('browser-stdout')();
console.log = function() { stdout.write.apply(stdout, arguments); };

Other packages similar to browser-stdout

Readme

Source

wat?

process.stdout in your browser.

wai?

iono. cuz hakz.

hau?

var BrowserStdout = require('browser-stdout')

myStream.pipe(BrowserStdout())

monkey

You can monkey-patch process.stdout for your dependency graph like this:

process.stdout = require('browser-stdout')()
var coolTool = require('module-that-uses-stdout-somewhere-in-its-depths')

opts

opts are passed directly to stream.Writable. additionally, a label arg can be used to label console output.

BrowserStdout({
  objectMode: true,
  label: 'dataz',
})

ur doin it rong

i accept pr's.

FAQs

Last updated on 27 Feb 2018

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc