{"name":"intercept-stdout","version":"0.1.2","description":"Hooking Node.js stdout","main":"intercept-stdout.js","directories":{"test":"test"},"scripts":{"test":"mocha"},"repository":{"type":"git","url":"https://github.com/sfarthin/intercept-stdout"},"keywords":["stdout","stderr"],"author":{"name":"Steven Farthing"},"license":"MIT","bugs":{"url":"https://github.com/sfarthin/intercept-stdout/issues"},"dependencies":{"lodash.toarray":"^3.0.0"},"devDependencies":{"chai":"~1.8.1","mocha":"~1.17.1"},"gitHead":"6a1338d630f422424c16fe1fb23f9934b80ee769","homepage":"https://github.com/sfarthin/intercept-stdout","_id":"intercept-stdout@0.1.2","_shasum":"126abf1fae6c509a428a98c61a631559042ae9fd","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"stevefar","email":"me@stevefar.com"},"maintainers":[{"name":"stevefar","email":"me@stevefar.com"}],"dist":{"shasum":"126abf1fae6c509a428a98c61a631559042ae9fd","tarball":"http://registry-npm.ywwl.com/intercept-stdout/download/intercept-stdout-0.1.2.tgz","integrity":"sha512-Umb41Ryp5FzLurfCRAWx+jjNAk8jsw2RTk2XPIwus+86h/Y2Eb4DfOWof/mZ6FBww8SoO45rJSlg25054/Di9w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHBbnmy4QNA03JB0yAMFb9QirIgOXbFarz9rxXyV/ceTAiA5VwNE3UrlwAsSOjPRZyj1NyHKqjo42Q7YOqexky8iew=="}],"size":3395,"noattachment":false,"key":"/intercept-stdout/-/intercept-stdout-0.1.2.tgz"},"readme":"# Node.js Intercept stdout\n\n> intercept-stdout captures or modifies stdout and/or stderr.\n\n> _<sup>Based on [this](https://gist.github.com/benbuckman/2758563) gist</sup>_\n\n## Capture\n```javascript\nvar intercept = require(\"intercept-stdout\"),\n\tcaptured_text = \"\";\n\nvar unhook_intercept = intercept(function(txt) {\n\tcaptured_text += txt;\n});\n\nconsole.log(\"This text is being captured\");\n\n// Let's stop capturing stdout.\nunhook_intercept();\n\nconsole.log(\"This text is not being captured\");\n```\n\n## Modify\n```javascript\nvar intercept = require(\"intercept-stdout\");\n\nvar unhook_intercept = intercept(function(txt) {\n\treturn txt.replace( /this/i , 'that' );\n});\n\nconsole.log(\"This text is being modified\");\n// -> that text is being modified\n```\n\n## Test\n\n\tnpm install\n\tnpm test\n\n## Separating Error Text\n\nStarting in Version 0.1.2, you may now specify two interceptor callbacks. If a second interceptor callback is specified, the second callback will be invoked for `stderr` output.\n\n## Errors and Warnings\n\nVersions > 0.1.1 hook both `stdout` and `stderr`. This change enables capturing of `console.log`, `console.info`, `console.warn`, and `console.error`. This change may break pre-existing interceptors if your interceptor expected output to be a full line of text.\n\n## About Colorization\n\nPopular modules such as [`mocha`](http://mochajs.org/) and [`winston`](https://github.com/winstonjs/winston) may colorize output by inserting ANSI escape codes into the output stream. Both `mocha` and `winston` make multiple calls to the output streams while colorizing a line -- in order to be robust, your code should anticipate and deal with this.\n","publish_time":1438173356903,"_cnpm_publish_time":1438173356903,"dist-tags":{"latest":"0.1.2"}}