{"_id":"miniwrite","_rev":"4579125","name":"miniwrite","description":"Minimal semantic output writer","dist-tags":{"latest":"0.1.4"},"maintainers":[{"name":"bartvds","email":"bartvanderschoor@gmail.com"}],"time":{"modified":"2026-04-10T15:53:11.000Z","created":"2013-11-28T14:24:40.229Z","0.1.4":"2014-12-03T21:05:21.254Z","0.1.3":"2013-12-12T20:28:33.001Z","0.1.2":"2013-12-02T15:14:44.207Z","0.1.1":"2013-11-28T14:31:23.005Z","0.1.0":"2013-11-28T14:24:40.229Z"},"users":{},"author":{"name":"Bart van der Schoor","url":"https://github.com/Bartvds"},"repository":{"type":"git","url":"https://github.com/Bartvds/miniwrite"},"versions":{"0.1.4":{"name":"miniwrite","description":"Minimal semantic output writer","version":"0.1.4","homepage":"https://github.com/Bartvds/miniwrite","author":{"name":"Bart van der Schoor","url":"https://github.com/Bartvds"},"repository":{"type":"git","url":"https://github.com/Bartvds/miniwrite"},"bugs":{"url":"https://github.com/Bartvds/miniwrite/issues"},"licenses":[{"type":"MIT","url":"https://github.com/Bartvds/miniwrite/blob/master/LICENSE-MIT"}],"keywords":["cli","ansi","text","color","stream","adapter","writer"],"main":"lib/","engines":{"node":">= 0.10.0"},"scripts":{"test":"grunt test"},"dependencies":{"mkdirp":"~0.3.5"},"devDependencies":{"grunt":"~0.4.2","grunt-cli":"~0.1.0","grunt-mocha-test":"~0.7.0","mocha-unfunk-reporter":"~0.3.7","grunt-contrib-clean":"~0.5.0","grunt-contrib-jshint":"~0.7.2","jshint-path-reporter":"~0.1.3","chai":"~1.8.1"},"_id":"miniwrite@0.1.4","_shasum":"72f02385c0ac37d542efe27dc6764b31908725ce","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"bartvds","email":"bartvanderschoor@gmail.com"},"maintainers":[{"name":"bartvds","email":"bartvanderschoor@gmail.com"}],"dist":{"shasum":"72f02385c0ac37d542efe27dc6764b31908725ce","size":6506,"noattachment":false,"key":"/miniwrite/-/miniwrite-0.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/miniwrite/download/miniwrite-0.1.4.tgz"},"directories":{},"publish_time":1417640721254,"_hasShrinkwrap":false,"_cnpm_publish_time":1417640721254,"_cnpmcore_publish_time":"2021-12-16T21:35:53.281Z"},"0.1.3":{"name":"miniwrite","description":"Minimal semantic output writer","version":"0.1.3","homepage":"https://github.com/Bartvds/miniwrite","author":{"name":"Bart van der Schoor","url":"https://github.com/Bartvds"},"repository":{"type":"git","url":"https://github.com/Bartvds/miniwrite"},"bugs":{"url":"https://github.com/Bartvds/miniwrite/issues"},"licenses":[{"type":"MIT","url":"https://github.com/Bartvds/miniwrite/blob/master/LICENSE-MIT"}],"keywords":["cli","ansi","text","color","stream","adapter","writer"],"main":"lib/","engines":{"node":">= 0.10.0"},"scripts":{"test":"grunt test"},"dependencies":{"mkdirp":"~0.3.5"},"devDependencies":{"grunt":"~0.4.2","grunt-cli":"~0.1.0","grunt-mocha-test":"~0.7.0","mocha-unfunk-reporter":"~0.3.7","grunt-contrib-clean":"~0.5.0","grunt-contrib-jshint":"~0.7.2","jshint-path-reporter":"~0.1.3","chai":"~1.8.1"},"readmeFilename":"README.md","_id":"miniwrite@0.1.3","dist":{"shasum":"9e893efb435f853454ca0321b86a44378e8c50c6","size":6418,"noattachment":false,"key":"/miniwrite/-/miniwrite-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/miniwrite/download/miniwrite-0.1.3.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"bartvds","email":"bartvanderschoor@gmail.com"},"maintainers":[{"name":"bartvds","email":"bartvanderschoor@gmail.com"}],"directories":{},"publish_time":1386880113001,"_hasShrinkwrap":false,"_cnpm_publish_time":1386880113001,"_cnpmcore_publish_time":"2021-12-16T21:35:53.488Z"},"0.1.2":{"name":"miniwrite","description":"Minimal semantic output writer","version":"0.1.2","homepage":"https://github.com/Bartvds/miniwrite","author":{"name":"Bart van der Schoor","url":"https://github.com/Bartvds"},"repository":{"type":"git","url":"https://github.com/Bartvds/miniwrite"},"bugs":{"url":"https://github.com/Bartvds/miniwrite/issues"},"licenses":[{"type":"MIT","url":"https://github.com/Bartvds/miniwrite/blob/master/LICENSE-MIT"}],"keywords":["cli","ansi","color","stream","adapter","writer"],"main":"lib/","engines":{"node":">= 0.10.0"},"scripts":{"test":"grunt test"},"dependencies":{"mkdirp":"~0.3.5"},"devDependencies":{"grunt":"~0.4.2","grunt-cli":"~0.1.0","grunt-mocha-test":"~0.7.0","mocha-unfunk-reporter":"~0.3.7","grunt-contrib-clean":"~0.5.0","grunt-contrib-jshint":"~0.7.2","jshint-path-reporter":"~0.1.3","chai":"~1.8.1"},"readmeFilename":"README.md","_id":"miniwrite@0.1.2","dist":{"shasum":"a6deaada4440e85c07dc3160704d0cb93c7269b9","size":6420,"noattachment":false,"key":"/miniwrite/-/miniwrite-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/miniwrite/download/miniwrite-0.1.2.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"bartvds","email":"bartvanderschoor@gmail.com"},"maintainers":[{"name":"bartvds","email":"bartvanderschoor@gmail.com"}],"directories":{},"publish_time":1385997284207,"_hasShrinkwrap":false,"_cnpm_publish_time":1385997284207,"_cnpmcore_publish_time":"2021-12-16T21:35:53.691Z"},"0.1.1":{"name":"miniwrite","description":"Minimal semantic output writer","version":"0.1.1","homepage":"https://github.com/Bartvds/miniwrite","author":{"name":"Bart van der Schoor","url":"https://github.com/Bartvds"},"repository":{"type":"git","url":"https://github.com/Bartvds/miniwrite"},"bugs":{"url":"https://github.com/Bartvds/miniwrite/issues"},"licenses":[{"type":"MIT","url":"https://github.com/Bartvds/miniwrite/blob/master/LICENSE-MIT"}],"keywords":["cli","ansi","color","stream","adapter","writer"],"main":"lib/miniwrite.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"grunt test"},"dependencies":{},"devDependencies":{"grunt":"~0.4.2","grunt-cli":"~0.1.0","grunt-mocha-test":"~0.7.0","mocha-unfunk-reporter":"~0.3.7","grunt-contrib-clean":"~0.5.0","grunt-contrib-jshint":"~0.7.2","jshint-path-reporter":"~0.1.3","chai":"~1.8.1"},"_id":"miniwrite@0.1.1","dist":{"shasum":"bec628b7f92ace5d55c1269c76a5a51b697cda02","size":3932,"noattachment":false,"key":"/miniwrite/-/miniwrite-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/miniwrite/download/miniwrite-0.1.1.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"bartvds","email":"bartvanderschoor@gmail.com"},"maintainers":[{"name":"bartvds","email":"bartvanderschoor@gmail.com"}],"directories":{},"publish_time":1385649083005,"_hasShrinkwrap":false,"_cnpm_publish_time":1385649083005,"_cnpmcore_publish_time":"2021-12-16T21:35:53.948Z"},"0.1.0":{"name":"miniwrite","description":"Minimal semantic output writer","version":"0.1.0","homepage":"https://github.com/Bartvds/miniwrite","author":{"name":"Bart van der Schoor","url":"https://github.com/Bartvds"},"repository":{"type":"git","url":"https://github.com/Bartvds/miniwrite"},"bugs":{"url":"https://github.com/Bartvds/miniwrite/issues"},"licenses":[{"type":"MIT","url":"https://github.com/Bartvds/miniwrite/blob/master/LICENSE-MIT"}],"keywords":["cli","ansi","color","stream","adapter","writer"],"main":"lib/miniwrite.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"grunt test"},"dependencies":{},"devDependencies":{"grunt":"~0.4.2","grunt-cli":"~0.1.0","grunt-mocha-test":"~0.7.0","mocha-unfunk-reporter":"~0.3.7","grunt-contrib-clean":"~0.5.0","grunt-contrib-jshint":"~0.7.2","jshint-path-reporter":"~0.1.3","chai":"~1.8.1"},"peerDependencies":{"grunt":"~0.4.2"},"_id":"miniwrite@0.1.0","dist":{"shasum":"ca22eaf533e781353feca9da3b22f77375807c7b","size":5272,"noattachment":false,"key":"/miniwrite/-/miniwrite-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/miniwrite/download/miniwrite-0.1.0.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"bartvds","email":"bartvanderschoor@gmail.com"},"maintainers":[{"name":"bartvds","email":"bartvanderschoor@gmail.com"}],"directories":{},"publish_time":1385648680229,"_hasShrinkwrap":false,"_cnpm_publish_time":1385648680229,"_cnpmcore_publish_time":"2021-12-16T21:35:54.390Z"}},"readme":"# miniwrite\r\n\r\n[![Build Status](https://secure.travis-ci.org/Bartvds/miniwrite.png?branch=master)](http://travis-ci.org/Bartvds/miniwrite) [![Dependency Status](https://gemnasium.com/Bartvds/miniwrite.png)](https://gemnasium.com/Bartvds/miniwrite) [![NPM version](https://badge.fury.io/js/miniwrite.png)](http://badge.fury.io/js/miniwrite)\r\n\r\n> Minimal output-stream writer API. \r\n\r\nA pluggable output writer interface/adapter to embed/expose in tools and reporters, also a simplified stream.  \r\n\r\nThis is not a logging framework or full console or stream replacement. Instead this is an abstraction to build on or expose in other tools. Intend as companion to [ministyle](https://github.com/Bartvds/ministyle) (et al).\r\n\r\n## API\r\n\r\nMain usage:\r\n````js\r\n// simplified node.js.browser compatible console.log()\r\nvar mw = miniwrite.console();\r\n\r\n// write plain text line\r\nmw.writeln('hello world!');\r\n````\r\n\r\n## Helpers\r\n\r\nBuffer writes:\r\n````js\r\n// buffer own lines\r\nvar mw = miniwrite.buffer();\r\n// buffer other writes (handy for testing)\r\nvar mw = miniwrite.buffer(myMiniWrite);\r\n\r\n// get buffer\r\nvar str = mw.concat();\r\nvar str = mw.concat('\\n\\n', '\\t');\r\n// iterate buffer if you must\r\nmw.lines.forEach(function(line) {\r\n\t//..\r\n})\r\n// clear buffer\r\nmw.clear();\r\n````\r\n\r\nAdapter to buffer character writes via `mw.write(chars)`, auto-flushes on newlines:\r\n````js\r\nvar mw = miniwrite.chars(miniwrite.console());\r\n\r\n// write plain text line\r\nmw.write('hello');\r\nmw.write(' ');\r\nmw.writeln('world!'); // \"hello world\\n\"\r\n\r\n//or accumulate chars\r\nmw.write('one');\r\nmw.write('two');\r\nmw.flush(true); // onetwo\r\n\r\n// clear buffer\r\nmw.write('one');\r\nmw.clear();\r\nmw.write('two');\r\nmw.flush(true); // two\r\n\r\n````\r\n\r\nSpread of multiple writers\r\n````js\r\nvar mw = miniwrite.multi([myANSIConsole, myRemoteSocket, myDiskLogger]);\r\nmw.enabled = true;\r\nmw.targets.forEach(function(subw, num) {\r\n\t// .. \r\n});\r\n````\r\n\r\nProxy to toggle stream or swap output target:\r\n````js\r\nvar mw = miniwrite.peek(myMiniWrite, callback);\r\nmw.enabled = true;\r\nmw.target = myOherWrite;\r\nmw.callback = function(line) {\r\n\t// return string, or false to ignore\r\n});\r\n````\r\n\r\nProxy to toggle stream or swap output target:\r\n````js\r\nvar mw = miniwrite.proxy(myMiniWrite);\r\nmw.enabled = true;\r\nmw.target = myOherWrite;\r\nmw.target = myOherWrite;\r\n````\r\n\r\nConvenience preset for [grunt](https://github.com/gruntjs/grunt) (same as in `grunt ~0.4.1`):\r\n````js\r\nvar mw = miniwrite.grunt(grunt);\r\n````\r\n## Examples\r\n\r\nBuild your own:\r\n````js\r\nvar mw = {};\r\nmw.writeln = function(line) {\r\n\tmyWebSocketHyperStream.send({line: line})\r\n};\r\n// pass to supporting tools\r\nawesomeModule.useMiniWritePlz(mw);\r\n````\r\n\r\nTap into output\r\n````js\r\nawesomeModule.writer = miniwrite.splitter([awesomeModule.writer, myMiniWrite]);\r\n````\r\n\r\n## Installation \r\n\r\n```shell\r\n$ npm install miniwrite --save\r\n```\r\n\r\n## History\r\n\r\n* 0.1.2 - Enabled strict mode, split in internal modules\r\n* 0.1.0 - Extracted styling to [ministyle](https://github.com/Bartvds/ministyle).\r\n* 0.0.1 - Extracted code from existing projects\r\n\r\n## Build\r\n\r\nInstall development dependencies in your git checkout:\r\n\r\n    $ npm install\r\n\r\n~Build and run tests:\r\n\r\n    $ grunt\r\n\r\nSee the `Gruntfile.js` for additional commands.\r\n\r\n## Contributing\r\n\r\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).\r\n\r\n*Note:* this is an opinionated module: please create a [ticket](https://github.com/Bartvds/miniwrite/issues) to discuss any big ideas. Pull requests for bug fixes are of course always welcome. \r\n\r\n## License\r\n\r\nCopyright (c) 2013 Bart van der Schoor\r\n\r\nLicensed under the MIT license.\r\n\r\n\r\n","_attachments":{},"homepage":"https://github.com/Bartvds/miniwrite","bugs":{"url":"https://github.com/Bartvds/miniwrite/issues"}}