package/package.json000644 0000000475 13245312451011573 0ustar00000000 000000 { "name": "browser-stdout", "version": "1.3.1", "description": "", "repository": { "type": "git", "url": "http://github.com/kumavis/browser-stdout.git" }, "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "kumavis", "license": "ISC" } package/index.js000644 0000001211 13245312404010735 0ustar00000000 000000 var WritableStream = require('stream').Writable var inherits = require('util').inherits module.exports = BrowserStdout inherits(BrowserStdout, WritableStream) function BrowserStdout(opts) { if (!(this instanceof BrowserStdout)) return new BrowserStdout(opts) opts = opts || {} WritableStream.call(this, opts) this.label = (opts.label !== undefined) ? opts.label : 'stdout' } BrowserStdout.prototype._write = function(chunks, encoding, cb) { var output = chunks.toString ? chunks.toString() : chunks if (this.label === false) { console.log(output) } else { console.log(this.label+':', output) } process.nextTick(cb) } package/LICENSE000644 0000001321 13245312404010277 0ustar00000000 000000 Copyright 2018 kumavis Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. package/README.md000644 0000001143 13245312404010553 0ustar00000000 000000 ### wat? `process.stdout` in your browser. ### wai? iono. cuz hakz. ### hau? ```js 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. ```js BrowserStdout({ objectMode: true, label: 'dataz', }) ``` ### ur doin it rong i accept pr's.