Latest Socket ResearchMalicious Chrome Extension Performs Hidden Affiliate Hijacking.Details
Socket
Book a DemoInstallSign in
Socket

stdout

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stdout

pipe objects to console.log

latest
Source
npmnpm
Version
0.0.3
Version published
Weekly downloads
684
-25.57%
Maintainers
1
Weekly downloads
 
Created
Source

stdout

When working with object streams, do you ever wish you could just pipe to console.log?

Now you can.

var request = require('request')
var JSONStream = require('JSONStream')
var stdout = require('stdout')

request('http://isaacs.couchone.com/registry/_all_docs')
  .pipe(JSONStream.parse('rows.*'))
  .pipe(stdout())

stdout([outputStream, prefix])

outputStream is optional. Defaults to process.stdout, but you can provide another stream like process.stderr if you want.

prefix is an optional string argument. If provided it will prepend each message with the prefix.

e.g. stdout('foo: ')('bar') would write out foo: bar

In the browser, it will automatically use console.log

Returns a writable stream that accepts Buffers, strings, or objects.

  • When given a Buffer, it outputs it directly.
  • When given a string, it just outputs it with a newline, just like console.log.
  • When given an object, it uses util.inspect and a newline, just like console.log.

License

MIT

Keywords

stdout

FAQs

Package last updated on 04 Feb 2014

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