{"_id":"outpipe","_rev":"88159","name":"outpipe","description":"write output to a file through shell commands","dist-tags":{"latest":"1.1.1"},"maintainers":[{"name":"substack","email":""}],"time":{"modified":"2021-06-03T10:28:39.000Z","created":"2015-03-08T07:17:51.455Z","1.1.1":"2015-04-04T03:56:20.520Z","1.1.0":"2015-03-08T18:42:03.017Z","1.0.2":"2015-03-08T09:39:33.048Z","1.0.1":"2015-03-08T09:22:58.706Z","1.0.0":"2015-03-08T07:17:51.455Z"},"users":{},"author":{"name":"substack"},"repository":{"type":"git","url":"git://github.com/substack/outpipe.git"},"versions":{"1.1.1":{"name":"outpipe","version":"1.1.1","description":"write output to a file through shell commands","main":"index.js","directories":{"example":"example"},"dependencies":{"shell-quote":"^1.4.2"},"devDependencies":{"gaze":"^0.5.1","minimist":"^1.1.0","osenv":"^0.1.0","tape":"^3.5.0","xtend":"^4.0.0"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/outpipe.git"},"keywords":["output","file","pipe","shell","exec","spawn","createWriteStream","redirect"],"author":{"name":"substack"},"license":"MIT","bugs":{"url":"https://github.com/substack/outpipe/issues"},"homepage":"https://github.com/substack/outpipe","gitHead":"faedcfb71949809a448e5ff340d4803efb5f3a72","_id":"outpipe@1.1.1","_shasum":"50cf8616365e87e031e29a5ec9339a3da4725fa2","_from":".","_npmVersion":"2.7.5","_nodeVersion":"1.6.3","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":""}],"dist":{"shasum":"50cf8616365e87e031e29a5ec9339a3da4725fa2","size":3319,"noattachment":false,"key":"/outpipe/-/outpipe-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/outpipe/download/outpipe-1.1.1.tgz"},"publish_time":1428119780520,"_cnpm_publish_time":1428119780520,"_hasShrinkwrap":false},"1.1.0":{"name":"outpipe","version":"1.1.0","description":"write output to a file through shell commands","main":"index.js","directories":{"example":"example"},"dependencies":{"shell-quote":"^1.4.2"},"devDependencies":{"gaze":"^0.5.1","minimist":"^1.1.0","osenv":"^0.1.0","tape":"^3.5.0","xtend":"^4.0.0"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/outpipe.git"},"keywords":["output","file","pipe","shell","exec","spawn","createWriteStream","redirect"],"author":{"name":"substack"},"license":"MIT","bugs":{"url":"https://github.com/substack/outpipe/issues"},"homepage":"https://github.com/substack/outpipe","gitHead":"471b2b409dd64273cafe72d40fb712bd8245c3a1","_id":"outpipe@1.1.0","_shasum":"76b3a2381c4a9e0e034b3cb69e38c45c0361fcd2","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.12.0","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":""}],"dist":{"shasum":"76b3a2381c4a9e0e034b3cb69e38c45c0361fcd2","size":3272,"noattachment":false,"key":"/outpipe/-/outpipe-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/outpipe/download/outpipe-1.1.0.tgz"},"publish_time":1425840123017,"_cnpm_publish_time":1425840123017,"_hasShrinkwrap":false},"1.0.2":{"name":"outpipe","version":"1.0.2","description":"write output to a file through shell commands","main":"index.js","directories":{"example":"example"},"dependencies":{"shell-quote":"^1.4.2"},"devDependencies":{"gaze":"^0.5.1","minimist":"^1.1.0","osenv":"^0.1.0","tape":"^3.5.0","xtend":"^4.0.0"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/outpipe.git"},"keywords":["output","file","pipe","shell","exec","spawn","createWriteStream","redirect"],"author":{"name":"substack"},"license":"MIT","bugs":{"url":"https://github.com/substack/outpipe/issues"},"homepage":"https://github.com/substack/outpipe","gitHead":"4f66ad259bb6c543aed41cf12171d061d962a789","_id":"outpipe@1.0.2","_shasum":"fcae3ea1add9450c425f24580539faa985791e3b","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.12.0","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":""}],"dist":{"shasum":"fcae3ea1add9450c425f24580539faa985791e3b","size":3217,"noattachment":false,"key":"/outpipe/-/outpipe-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/outpipe/download/outpipe-1.0.2.tgz"},"publish_time":1425807573048,"_cnpm_publish_time":1425807573048,"_hasShrinkwrap":false},"1.0.1":{"name":"outpipe","version":"1.0.1","description":"write output to a file through shell commands","main":"index.js","directories":{"example":"example"},"dependencies":{"duplexer2":"^0.0.2","shell-quote":"^1.4.2","stream-combiner2":"^1.0.2","through2":"^0.6.3","write-only-stream":"^1.1.0"},"devDependencies":{"gaze":"^0.5.1","minimist":"^1.1.0","osenv":"^0.1.0","tape":"^3.5.0","xtend":"^4.0.0"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/outpipe.git"},"keywords":["output","file","pipe","shell","exec","spawn","createWriteStream","redirect"],"author":{"name":"substack"},"license":"MIT","bugs":{"url":"https://github.com/substack/outpipe/issues"},"homepage":"https://github.com/substack/outpipe","gitHead":"97417f9b6e1784e8151c12bc929b83934314ca0a","_id":"outpipe@1.0.1","_shasum":"5d89e9f6984f9636c1908691e5930891354fc011","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.12.0","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":""}],"dist":{"shasum":"5d89e9f6984f9636c1908691e5930891354fc011","size":3565,"noattachment":false,"key":"/outpipe/-/outpipe-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/outpipe/download/outpipe-1.0.1.tgz"},"publish_time":1425806578706,"_cnpm_publish_time":1425806578706,"_hasShrinkwrap":false},"1.0.0":{"name":"outpipe","version":"1.0.0","description":"write output to a file through shell commands","main":"index.js","directories":{"example":"example"},"dependencies":{"duplexer2":"^0.0.2","shell-quote":"^1.4.2","stream-combiner2":"^1.0.2","through2":"^0.6.3","write-only-stream":"^1.1.0"},"devDependencies":{"gaze":"^0.5.1","minimist":"^1.1.0","osenv":"^0.1.0","tape":"^3.5.0","xtend":"^4.0.0"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/outpipe.git"},"keywords":["output","file","pipe","shell","exec","spawn","createWriteStream","redirect"],"author":{"name":"substack"},"license":"MIT","bugs":{"url":"https://github.com/substack/outpipe/issues"},"homepage":"https://github.com/substack/outpipe","gitHead":"bf01b89b7fe56db642ea791cb6afe02edfd7f9c4","_id":"outpipe@1.0.0","_shasum":"db7a87106e5b23726e25e908efd23feb5232cd89","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.12.0","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":""}],"dist":{"shasum":"db7a87106e5b23726e25e908efd23feb5232cd89","size":3586,"noattachment":false,"key":"/outpipe/-/outpipe-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/outpipe/download/outpipe-1.0.0.tgz"},"publish_time":1425799071455,"_cnpm_publish_time":1425799071455,"_hasShrinkwrap":false}},"readme":"# outpipe\n\nwrite output to a file through shell commands\n\n# purpose\n\nSuppose you have a tool like\n[watchify](https://npmjs.com/package/watchify)\nor [factor-bundle](https://npmjs.com/package/factor-bundle)\nthat write to multiple files or write to the same file more than once.\n\nIf you want to pipe the output of these tools to other programs, such as\nminification with the `uglify` command, it's very difficult! You might need to\nuse the tool's API or use a separate command to watch for changes to the output\nfiles. Ick.\n\nYou don't get the elegance of something like:\n\n``` sh\n$ browserify main.js | uglifyjs -cm | gzip > bundle.js.gz\n```\n\nUntil now! With this library and a hypothetical version of watchify, you could\ndo:\n\n``` sh\n$ watchify main.js -dv -o 'uglifyjs -cm | gzip > bundle.js.gz'\n```\n\n# example\n\nHere's a small watcher program that will just copy input files to a destination,\nbut transforms can be applied along the way with shell pipes and redirects.\n\n``` js\nvar outpipe = require('outpipe');\nvar gaze = require('gaze');\nvar fs = require('fs');\n\nvar minimist = require('minimist');\nvar argv = minimist(process.argv.slice(2), {\n    alias: { o: 'output' }\n});\n\nvar file = argv._[0];\ngaze(file, function (err, w) {\n    w.on('changed', read);\n});\nread();\n\nfunction read () {\n    var r = fs.createReadStream(file);\n    r.pipe(outpipe(argv.output));\n}\n```\n\nWe can run the program with a single output file:\n\n``` sh\n$ node watch.js input/x.js -o output/hmm.js\n```\n\nwhich just copies `x.js` to `output/hmm.js` whenever `x.js` changes.\n\nWe could also run a minification step using the `uglify` command:\n\n``` sh\n$ node watch.js input/x.js -o 'uglifyjs -cm > output/wow.js'\n```\n\nor we can just print the size of the minified and gzipped output to stdout:\n\n``` sh\n$ node watch.js input/x.js -o 'uglifyjs -cm | gzip | wc -c'\n123\n```\n\nor we could write that size to a file:\n\n``` sh\n$ node watch.js input/x.js -o 'uglifyjs -cm | gzip | wc -c > size.txt'\n```\n\n# methods\n\n``` js\nvar outpipe = require('outpipe')\n```\n\n## var w = outpipe(cmd, opts={})\n\nReturn a writable stream `w` that will pipe output to the command string `cmd`.\n\nIf `cmd` has no operators (`|` or `>`), it will write to a file.\n\nOtherwise, each command between pipes will be executed and output is written to\na file if `>` is given.\n\n`opts` can be:\n\n* `opts.env` - an object mapping environment variables to their values or a\n`function (key) {}` that returns the values.\n\nstdout and stderr are forwarded to process.stdout and process.stderr if\nunhandled in the command.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install outpipe\n```\n\n# license\n\nMIT\n","_attachments":{},"homepage":"https://github.com/substack/outpipe","bugs":{"url":"https://github.com/substack/outpipe/issues"},"license":"MIT"}