{"_id":"outpipe","_rev":"13-2cc01eb706167580182bda67b2d3973f","name":"outpipe","description":"write output to a file through shell commands","dist-tags":{"latest":"1.1.1"},"versions":{"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":"mail@substack.net"}],"dist":{"shasum":"db7a87106e5b23726e25e908efd23feb5232cd89","tarball":"https://registry.npmjs.org/outpipe/-/outpipe-1.0.0.tgz","integrity":"sha512-c9qI07N2E1JOu+4qR8nufMMAdnNqoOmgjscdmVXeuUSbZhwCvtxWMN2hxpj2oiZt9xXXf9eS7g3MUKqWtfeReA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGXW68DC7GAMJc8pjW6NlrHN/ddttW45427U2+Gh+TZnAiEAt7oYProSa9IrhzA0kTong5WDAcTt/44Aj06WXNgiQFA="}]}},"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":"mail@substack.net"}],"dist":{"shasum":"5d89e9f6984f9636c1908691e5930891354fc011","tarball":"https://registry.npmjs.org/outpipe/-/outpipe-1.0.1.tgz","integrity":"sha512-5p4E6FamU1pR9scvKm7i7yueGZABccCHHiug8dJA1A0HRLtSCAvBCRdyvjdlNQFtTYInxNVh1DD67VS9nf2Mdw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDO9lybB5TtG0o7lJFucTkrYl9mD3b0OcPUmYgSMgWD6gIhAKzbOv4zwBLOxcWU1t6rjRZH0GPnQh/mYmHALjTXTZVX"}]}},"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":"mail@substack.net"}],"dist":{"shasum":"fcae3ea1add9450c425f24580539faa985791e3b","tarball":"https://registry.npmjs.org/outpipe/-/outpipe-1.0.2.tgz","integrity":"sha512-oL9n6iAXxqdw5lXYWXK97RreE2WkGMbuKArCVnyeXITQNfm/KwMgZlKajWOeLdAwc8ZOhKhtZSHccQb0H+wYtw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEZDGDa9WcvsrUiFOxzrvUAcocnZlsZdkU6zieFDggQwIgAnwN2AAQyWEBdX9hbqK59RYULeaIHQFGILI6WeRjRyU="}]}},"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":"mail@substack.net"}],"dist":{"shasum":"76b3a2381c4a9e0e034b3cb69e38c45c0361fcd2","tarball":"https://registry.npmjs.org/outpipe/-/outpipe-1.1.0.tgz","integrity":"sha512-K8AenzGh26zxGLzLAqz0xxqJheckj1h65FcqqA9bCaFnFLcL1ytma4vZhAwMw0+6pVZo9j4R2GwiRwRetUObKg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD1XDtPuPwNGcS/5SXUPYOEUGQbpXu50TJ8yCliCVHe+wIgcUJjlrrsIVXHN/PGWygs1hPwxB2NCNdvqTUWNbONQ0c="}]}},"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":"mail@substack.net"}],"dist":{"shasum":"50cf8616365e87e031e29a5ec9339a3da4725fa2","tarball":"https://registry.npmjs.org/outpipe/-/outpipe-1.1.1.tgz","integrity":"sha512-BnNY/RwnDrkmQdUa9U+OfN/Y7AWmKuUPCCd+hbRclZnnANvYpO72zp/a6Q4n829hPbdqEac31XCcsvlEvb+rtA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0yfI2GlUyJf8nrCCrugTFCi0ErI/i4V3jBbe59XznPQIgMv3zCkripjowQpusTIo/MFnp7hAt1c6xF0J+2+xFI4s="}]}}},"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","maintainers":[{"email":"nopersonsmodules@gmail.com","name":"nopersonsmodules"}],"time":{"modified":"2022-11-08T10:40:24.299Z","created":"2015-03-08T07:17:51.455Z","1.0.0":"2015-03-08T07:17:51.455Z","1.0.1":"2015-03-08T09:22:58.706Z","1.0.2":"2015-03-08T09:39:33.048Z","1.1.0":"2015-03-08T18:42:03.017Z","1.1.1":"2015-04-04T03:56:20.520Z"},"homepage":"https://github.com/substack/outpipe","keywords":["output","file","pipe","shell","exec","spawn","createWriteStream","redirect"],"repository":{"type":"git","url":"git://github.com/substack/outpipe.git"},"author":{"name":"substack"},"bugs":{"url":"https://github.com/substack/outpipe/issues"},"license":"MIT","readmeFilename":"readme.markdown"}