{"_id":"read-vinyl-file-stream","_rev":"10-2a52bd6c892a390253a16e45e95d0f6f","name":"read-vinyl-file-stream","description":"process a vinyl file stream with minimal code","dist-tags":{"latest":"2.0.3"},"versions":{"1.0.0":{"name":"read-vinyl-file-stream","version":"1.0.0","main":"index.js","scripts":{"test":"mocha","coverage":"istanbul cover --dir coverage node_modules/mocha/bin/_mocha"},"author":{"name":"Kiril Vatev","email":"vatev.1@gmail.com"},"license":"ISC","devDependencies":{"chai":"^3.5.0","codeclimate-test-reporter":"^0.3.3","istanbul":"^0.4.5","mocha":"^3.0.2","vinyl":"^1.2.0"},"directories":{"test":"test"},"dependencies":{"chai":"^3.5.0","istanbul":"^0.4.5","node-stream":"0.0.6","through2":"^2.0.1"},"repository":{"type":"git","url":"git+https://github.com/catdad/read-vinyl-file-stream.git"},"bugs":{"url":"https://github.com/catdad/read-vinyl-file-stream/issues"},"homepage":"https://github.com/catdad/read-vinyl-file-stream#readme","description":"process a vinyl file stream with minimal code","keywords":["vinyl","stream","gulp","plugin"],"gitHead":"a3a8b0905e8b02a709f68ee92cb65f27e24016af","_id":"read-vinyl-file-stream@1.0.0","_shasum":"e4c86e2e191d9bb5e074013eb4ad8ce48e12c56b","_from":".","_npmVersion":"2.15.1","_nodeVersion":"4.4.4","_npmUser":{"name":"kirilv","email":"vatev.1+npm@gmail.com"},"maintainers":[{"name":"kirilv","email":"vatev.1+npm@gmail.com"}],"dist":{"shasum":"e4c86e2e191d9bb5e074013eb4ad8ce48e12c56b","tarball":"https://registry.npmjs.org/read-vinyl-file-stream/-/read-vinyl-file-stream-1.0.0.tgz","integrity":"sha512-7k07FfwBSD9dmg+ONQ3Vkrk3d99YFlpnZYW06YFd8/th7fqsh5izmfdX6xuSsgKAJrKlK92bI7d12n4M13l1mQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDHRzFMqcOv7tida/1MQ9vhAifVOPEYORVg0iz4IA1R4QIgD4C63p1VNNfYOV5voVYlJwZ1WlXiPgZJK9PCMpytW24="}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/read-vinyl-file-stream-1.0.0.tgz_1474500053103_0.43121468485333025"}},"1.1.0":{"name":"read-vinyl-file-stream","version":"1.1.0","main":"index.js","scripts":{"test":"mocha","coverage":"istanbul cover --dir coverage node_modules/mocha/bin/_mocha"},"author":{"name":"Kiril Vatev","email":"vatev.1@gmail.com"},"license":"ISC","devDependencies":{"chai":"^3.5.0","codeclimate-test-reporter":"^0.3.3","istanbul":"^0.4.5","mocha":"^3.0.2","vinyl":"^1.2.0"},"directories":{"test":"test"},"dependencies":{"chai":"^3.5.0","istanbul":"^0.4.5","node-stream":"0.0.6","through2":"^2.0.1"},"repository":{"type":"git","url":"git+https://github.com/catdad/read-vinyl-file-stream.git"},"bugs":{"url":"https://github.com/catdad/read-vinyl-file-stream/issues"},"homepage":"https://github.com/catdad/read-vinyl-file-stream#readme","description":"process a vinyl file stream with minimal code","keywords":["vinyl","stream","gulp","plugin"],"gitHead":"65d9565dd3348e04edd040cff9f8c98b721d23fe","_id":"read-vinyl-file-stream@1.1.0","_shasum":"53236fd753650926cbd88e3834f69e74ad6573bd","_from":".","_npmVersion":"2.15.1","_nodeVersion":"4.4.4","_npmUser":{"name":"kirilv","email":"vatev.1+npm@gmail.com"},"maintainers":[{"name":"kirilv","email":"vatev.1+npm@gmail.com"}],"dist":{"shasum":"53236fd753650926cbd88e3834f69e74ad6573bd","tarball":"https://registry.npmjs.org/read-vinyl-file-stream/-/read-vinyl-file-stream-1.1.0.tgz","integrity":"sha512-2cAQ+VkW8EQ92SpsG/jm96eX/DefEVrm/30Cv8PqFuC949//IYgUsncvgf0UhW2LFT4YqlNjDMN7wbULsbWL9w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQChmcr/ieQDrjp8eOritjHmr8SsvABvoaOcMzJhN3paBQIhANi0lgwuvhmaQD9R5Q+GW9xr0tLBDc+7TuD7pzYLcPcT"}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/read-vinyl-file-stream-1.1.0.tgz_1474501162069_0.36921287747099996"}},"1.2.0":{"name":"read-vinyl-file-stream","version":"1.2.0","main":"index.js","scripts":{"test":"mocha","coverage":"istanbul cover --dir coverage node_modules/mocha/bin/_mocha"},"author":{"name":"Kiril Vatev","email":"vatev.1@gmail.com"},"license":"ISC","devDependencies":{"chai":"^3.5.0","codeclimate-test-reporter":"^0.3.3","istanbul":"^0.4.5","mocha":"^3.0.2","vinyl":"^1.2.0"},"directories":{"test":"test"},"dependencies":{"node-stream":"^1.5.0","through2":"^2.0.1"},"repository":{"type":"git","url":"git+https://github.com/catdad/read-vinyl-file-stream.git"},"bugs":{"url":"https://github.com/catdad/read-vinyl-file-stream/issues"},"homepage":"https://github.com/catdad/read-vinyl-file-stream#readme","description":"process a vinyl file stream with minimal code","keywords":["vinyl","stream","gulp","plugin"],"gitHead":"514666433a79b183cf7bf423eb94b16e6c306ccb","_id":"read-vinyl-file-stream@1.2.0","_shasum":"72395ff79bcac2ea97a1e14247c5597e17f8702f","_from":".","_npmVersion":"2.15.1","_nodeVersion":"4.4.4","_npmUser":{"name":"kirilv","email":"vatev.1+npm@gmail.com"},"maintainers":[{"name":"kirilv","email":"vatev.1+npm@gmail.com"}],"dist":{"shasum":"72395ff79bcac2ea97a1e14247c5597e17f8702f","tarball":"https://registry.npmjs.org/read-vinyl-file-stream/-/read-vinyl-file-stream-1.2.0.tgz","integrity":"sha512-0Tu5JiR4luGfWDaddWtsE+HF51z/OQSbeRowtoXFi1/x9qPLgqw/CfDrxOJmsknOOr6VGdVwGBHNdKonAafBJg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICdv9l55KVFMH0TJG7qIhDu9C8Zxj7dD4VwWiPeRwgGtAiEA3I5GM7FyAn2d1faV51CtQFzebtd9zpdxJ/n/Sdpt1a0="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/read-vinyl-file-stream-1.2.0.tgz_1486607707281_0.38222153205424547"}},"2.0.0":{"name":"read-vinyl-file-stream","version":"2.0.0","main":"index.js","scripts":{"test":"mocha","coverage":"istanbul cover --dir coverage node_modules/mocha/bin/_mocha"},"author":{"name":"Kiril Vatev","email":"vatev.1@gmail.com"},"license":"ISC","devDependencies":{"chai":"^3.5.0","codeclimate-test-reporter":"^0.3.3","is-stream":"^1.1.0","istanbul":"^0.4.5","mocha":"^3.0.2","vinyl":"^1.2.0"},"directories":{"test":"test"},"dependencies":{"node-stream":"^1.5.0","through2":"^2.0.1"},"repository":{"type":"git","url":"git+https://github.com/catdad/read-vinyl-file-stream.git"},"bugs":{"url":"https://github.com/catdad/read-vinyl-file-stream/issues"},"homepage":"https://github.com/catdad/read-vinyl-file-stream#readme","description":"process a vinyl file stream with minimal code","keywords":["vinyl","stream","gulp","plugin"],"gitHead":"ba869492620e65b3b685186dd4332e26d9f6bcd1","_id":"read-vinyl-file-stream@2.0.0","_shasum":"72b6beb9add891f0e9b993172b791744fbb43d27","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.4.0","_npmUser":{"name":"kirilv","email":"vatev.1+npm@gmail.com"},"maintainers":[{"name":"kirilv","email":"vatev.1+npm@gmail.com"}],"dist":{"shasum":"72b6beb9add891f0e9b993172b791744fbb43d27","tarball":"https://registry.npmjs.org/read-vinyl-file-stream/-/read-vinyl-file-stream-2.0.0.tgz","integrity":"sha512-1uYBt8rZo4rsqnysFLhAYzEWU2D/Ju8H++MTcv9qEAqjtashyC1upw1gdIf9zE3DZwIDFxB9ByYjveLp2Awflg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC8QztGalZS3I8VtNd+vtRaCf8V2vTNdaOAfD7fSo09xwIhAMyANoGKWys6q7N8tfEvFQWhRgkCEvXaThjRTngYg+zW"}]},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/read-vinyl-file-stream-2.0.0.tgz_1487732306117_0.3924553438555449"}},"2.0.1":{"name":"read-vinyl-file-stream","version":"2.0.1","main":"index.js","scripts":{"test":"mocha","coverage":"istanbul cover --dir coverage node_modules/mocha/bin/_mocha"},"author":{"name":"Kiril Vatev","email":"vatev.1@gmail.com"},"license":"ISC","devDependencies":{"chai":"^3.5.0","codeclimate-test-reporter":"^0.3.3","is-stream":"^1.1.0","istanbul":"^0.4.5","mocha":"^3.0.2","vinyl":"^1.2.0"},"directories":{"test":"test"},"dependencies":{"node-stream":"^1.5.0","through2":"^2.0.1"},"repository":{"type":"git","url":"git+https://github.com/catdad/read-vinyl-file-stream.git"},"bugs":{"url":"https://github.com/catdad/read-vinyl-file-stream/issues"},"homepage":"https://github.com/catdad/read-vinyl-file-stream#readme","description":"process a vinyl file stream with minimal code","keywords":["vinyl","stream","gulp","plugin"],"gitHead":"a6ca68152dd85b0e4d637bea98208f4d6b2dd5ce","_id":"read-vinyl-file-stream@2.0.1","_shasum":"af40bf599d723c2688e57f9ea2d36548a817a9b5","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.4.0","_npmUser":{"name":"kirilv","email":"vatev.1+npm@gmail.com"},"maintainers":[{"name":"kirilv","email":"vatev.1+npm@gmail.com"}],"dist":{"shasum":"af40bf599d723c2688e57f9ea2d36548a817a9b5","tarball":"https://registry.npmjs.org/read-vinyl-file-stream/-/read-vinyl-file-stream-2.0.1.tgz","integrity":"sha512-Q4AMtvbwVdzY2/9fy2TunXVeOsBl7jXCINujYE3/7+Bz4UGiINd2laxCnDwnkMTtbv3lPuvoxOgi0akWbylSUw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFH9RYNEiDlWPOCFbITwbZTFOZ5YZHGstlVDOR+MuVqTAiBXBR8oOJu1nbeDyo9U4hCupIgaeHdCHegMeKT1VTBKow=="}]},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/read-vinyl-file-stream-2.0.1.tgz_1487733033240_0.06017855182290077"}},"2.0.2":{"name":"read-vinyl-file-stream","version":"2.0.2","main":"index.js","scripts":{"test":"mocha","coverage":"istanbul cover --dir coverage node_modules/mocha/bin/_mocha"},"author":{"name":"Kiril Vatev","email":"vatev.1@gmail.com"},"license":"ISC","devDependencies":{"chai":"^3.5.0","codeclimate-test-reporter":"^0.3.3","is-stream":"^1.1.0","istanbul":"^0.4.5","mocha":"^3.0.2","vinyl":"^1.2.0"},"directories":{"test":"test"},"dependencies":{"node-stream":"^1.5.0","through2":"^2.0.1"},"repository":{"type":"git","url":"git+https://github.com/catdad/read-vinyl-file-stream.git"},"bugs":{"url":"https://github.com/catdad/read-vinyl-file-stream/issues"},"homepage":"https://github.com/catdad/read-vinyl-file-stream#readme","description":"process a vinyl file stream with minimal code","keywords":["vinyl","stream","gulp","plugin"],"gitHead":"ad2ff295884d8d7afe7a48095cdf974a433c8853","_id":"read-vinyl-file-stream@2.0.2","_shasum":"b0bf0c10ea7d80f78dce4c5fbd015e31b78dc0b2","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.4.0","_npmUser":{"name":"kirilv","email":"vatev.1+npm@gmail.com"},"maintainers":[{"name":"kirilv","email":"vatev.1+npm@gmail.com"}],"dist":{"shasum":"b0bf0c10ea7d80f78dce4c5fbd015e31b78dc0b2","tarball":"https://registry.npmjs.org/read-vinyl-file-stream/-/read-vinyl-file-stream-2.0.2.tgz","integrity":"sha512-+zaTufCLCBkTuCzgvwwPRI0cOB2EI0dLxX3V1t0mKPRTza5ZVN4sGi6cwz39ofXE2dfMtqcWXrgNt/t1zuMU/A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICd0Ztazh4gqNziPvHBQVKyP+BwUFi14gmToeajnkiJEAiEAsO00SyVFGIG7nGK9y/Urv5K94gqLjx+66hzCcfPuhd8="}]},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/read-vinyl-file-stream-2.0.2.tgz_1487807506606_0.9994134833104908"}},"2.0.3":{"name":"read-vinyl-file-stream","version":"2.0.3","main":"index.js","scripts":{"test":"mocha","coverage":"istanbul cover --dir coverage node_modules/mocha/bin/_mocha"},"author":{"name":"Kiril Vatev","email":"vatev.1@gmail.com"},"license":"ISC","devDependencies":{"chai":"^3.5.0","codeclimate-test-reporter":"^0.3.3","is-stream":"^1.1.0","istanbul":"^0.4.5","mocha":"^3.0.2","vinyl":"^1.2.0"},"directories":{"test":"test"},"dependencies":{"node-stream":"^1.5.0","through2":"^2.0.1"},"repository":{"type":"git","url":"git+https://github.com/catdad/read-vinyl-file-stream.git"},"bugs":{"url":"https://github.com/catdad/read-vinyl-file-stream/issues"},"homepage":"https://github.com/catdad/read-vinyl-file-stream#readme","description":"process a vinyl file stream with minimal code","keywords":["vinyl","stream","gulp","plugin"],"gitHead":"a00978398e801568e92cbadafeec42c35e418cfb","_id":"read-vinyl-file-stream@2.0.3","_shasum":"14e39b4ace033ad52dbc396718b1d5dca6d82915","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.4.0","_npmUser":{"name":"kirilv","email":"vatev.1+npm@gmail.com"},"maintainers":[{"name":"kirilv","email":"vatev.1+npm@gmail.com"}],"dist":{"shasum":"14e39b4ace033ad52dbc396718b1d5dca6d82915","tarball":"https://registry.npmjs.org/read-vinyl-file-stream/-/read-vinyl-file-stream-2.0.3.tgz","integrity":"sha512-ZbtobBf+n/va3eRcIkMDYsp7DCnnjh46YFOOdj42aCiWFirp9T/+YGMCTfVpEFIuiH3c5Kp13jpn3i5DoygxLw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDmoMBPmgy4QWIfeyg8yIf5oIBBqyz7O/YkcljDx/kqrQIgMHmaszEghrMq0lYrOrHRnzFOWSzs73QVEJmSPEPJptw="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/read-vinyl-file-stream-2.0.3.tgz_1488733211585_0.26572027429938316"}}},"readme":"# read vinyl file stream\n\n[![Build][1]][2]\n[![Test Coverage][3]][4]\n[![Code Climate][5]][6]\n[![Downloads][7]][8]\n[![Version][9]][8]\n[![Dependency Status][10]][11]\n\n[1]: https://travis-ci.org/catdad/read-vinyl-file-stream.svg?branch=master\n[2]: https://travis-ci.org/catdad/read-vinyl-file-stream\n\n[3]: https://codeclimate.com/github/catdad/read-vinyl-file-stream/badges/coverage.svg\n[4]: https://codeclimate.com/github/catdad/read-vinyl-file-stream/coverage\n\n[5]: https://codeclimate.com/github/catdad/read-vinyl-file-stream/badges/gpa.svg\n[6]: https://codeclimate.com/github/catdad/read-vinyl-file-stream\n\n[7]: https://img.shields.io/npm/dm/read-vinyl-file-stream.svg\n[8]: https://www.npmjs.com/package/read-vinyl-file-stream\n[9]: https://img.shields.io/npm/v/read-vinyl-file-stream.svg\n\n[10]: https://david-dm.org/catdad/read-vinyl-file-stream.svg\n[11]: https://david-dm.org/catdad/read-vinyl-file-stream\n\nTurns out that reading all the files in a vinyl stream is cumbersome, and supporting all of the options is a little bit annoying. I decided that I don't want to write that code more than once. So here is a library that does that. This is most useful for gulp plugins that need to transform all the files in a stream, though I am sure you can figure out other ways to use it too.\n\n## Install\n\n```bash\nnpm install read-vinyl-file-stream\n```\n\n## API\n\n### read-vinyl-file-stream(iterator {Function} [, flush {Function}] [, encoding {String}])\n\nThe module is a function that creates a transform stream. It will read the vinyl file, whether it is a buffer or a stream internally. It takes the following parameters, in order:\n\n- **[iterator]** _{Function}_ Required - the method that will process the files.\n- **[flush]** _{Function}_ Optional - the method to call before the stream ends.\n- **encoding** _{String}_ Optional - the encoding to use for the content provided to the iterator function. By default, this is a UTF-8 string. The following options are supported:\n  - `'utf8'` - provide the content in a UTF-8 string.\n  - `'buffer'` - provide the content in a raw buffer. This is useful if you are processing binary files, for example.\n\n[iterator]: #iteratorcontent-file-stream-cb\n#### iterator(content, file, stream, cb)\n\nThe function that you provide to it has the following parameters, in order:\n\n- **content** - the content of the file.\n- **file** - the vinyl file itself.\n- **stream** - the transform stream that is being iterated.\n- **cb** - a callback to call once you are done processing the file. You must call this in order for the stream to continue.\n\n[flush]: #flushstream-cb\n#### flush(stream, cb)\n\nThis is a function that will allow you to execute some code after all the files have been read but before the stream ends. It has the following parameters, in order:\n\n- **stream** - the transform stream that is being iterated.\n- **cb** - a callback to call once you are done with the flush actions. You must call this in order for the stream to end.\n\n## Examples\n\nObserve all of the files:\n\n```javascript\nvar readFiles = require('read-vinyl-file-stream');\n\nvar input = getVinylStream();\n\nvar hashOfFiles = {};\n\ninput.pipe(readFiles(function (content, file, stream, cb) {\n    hashOfFiles[file.path] = content;\n\n    cb();\n}));\n```\n\nTransform the content of the file and output it back to the stream:\n\n```javascript\nvar readFiles = require('read-vinyl-file-stream');\n\nvar input = getVinylStream();\n\ninput.pipe(readFiles(function (content, file, stream, cb) {\n    var newContent = doWorkToTheContent(content);\n\n    cb(null, newContent);\n}));\n```\n\nSplit the file into multiple files and output all of them to the stream:\n\n```javascript\nvar readFiles = require('read-vinyl-file-stream');\nvar File = require('vinyl');\n\nvar input = getVinylStream();\n\ninput.pipe(readFiles(function (content, file, stream, cb) {\n    var lines = content.split('\\n');\n\n    lines.forEach(function (line, idx) {\n        stream.push(new File({\n            contents: new Buffer(line),\n            path: file.path + 'line' + idx\n        }));\n    });\n\n    cb();\n}));\n```\n\nUse inside `gulp` (to create a filter):\n\n```javascript\nvar gulp = require('gulp');\nvar readFiles = require('read-vinyl-file-stream');\n\ngulp.task('mytask', function() {\n    return gulp.src('*.ext')\n        .pipe(readFiles(function (content, file, stream, cb) {\n            if (/^n/.test(content)) {\n                return cb(null, content);\n            }\n\n            cb();\n        }))\n        .pipe(gulp.dest('filesThatStartWithN'));\n});\n```\n","maintainers":[{"name":"kirilv","email":"vatev.1+npm@gmail.com"}],"time":{"modified":"2022-06-26T09:14:51.492Z","created":"2016-09-21T23:20:53.778Z","1.0.0":"2016-09-21T23:20:53.778Z","1.1.0":"2016-09-21T23:39:22.763Z","1.2.0":"2017-02-09T02:35:09.122Z","2.0.0":"2017-02-22T02:58:26.740Z","2.0.1":"2017-02-22T03:10:33.888Z","2.0.2":"2017-02-22T23:51:47.236Z","2.0.3":"2017-03-05T17:00:13.466Z"},"homepage":"https://github.com/catdad/read-vinyl-file-stream#readme","keywords":["vinyl","stream","gulp","plugin"],"repository":{"type":"git","url":"git+https://github.com/catdad/read-vinyl-file-stream.git"},"author":{"name":"Kiril Vatev","email":"vatev.1@gmail.com"},"bugs":{"url":"https://github.com/catdad/read-vinyl-file-stream/issues"},"license":"ISC","readmeFilename":"README.md","users":{"morewry":true}}