{"_id":"vinyl-fs-fake","_rev":"8-97326cf698b5cb5a2d54e677bbf53ac4","name":"vinyl-fs-fake","description":"Vinyl adapter for the file system that accepts fakes","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"vinyl-fs-fake","version":"1.0.0","description":"Vinyl adapter for the file system that accepts fakes","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"https://github.com/callumacrae/vinyl-fs-fake"},"keywords":["vinyl","file","fs","fake","mock","test"],"author":{"name":"Callum Macrae","email":"callum@macr.ae"},"license":"MIT","bugs":{"url":"https://github.com/callumacrae/vinyl-fs-fake/issues"},"homepage":"https://github.com/callumacrae/vinyl-fs-fake","dependencies":{"through2":"^0.6.3","vinyl":"^0.4.6","vinyl-fs":"^0.3.13"},"devDependencies":{"del":"^1.1.1","graceful-fs":"^3.0.5","mocha":"^2.1.0","should":"^5.0.0"},"gitHead":"e5bbe982600ca53e494b57ee283239dc04ec3f70","_id":"vinyl-fs-fake@1.0.0","_shasum":"2a7023c96f194917c6a047f9751582b3cb7e3496","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"callumacrae","email":"callum@macr.ae"},"maintainers":[{"name":"callumacrae","email":"callum@macr.ae"}],"dist":{"shasum":"2a7023c96f194917c6a047f9751582b3cb7e3496","tarball":"https://registry.npmjs.org/vinyl-fs-fake/-/vinyl-fs-fake-1.0.0.tgz","integrity":"sha512-Z3xIkZW7l6qm1KU1K1OBWIvEz+TTJ0ly6fyg4WIliAASamD7KB9hiiAXuLwWbjOtFoheYhjM+rcWBy0JgVy8Pg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEOA8NrguDcb49wrpmxRkrwrKyTEv2oGA9K4RHCR1VTAIgKlxrqokmwTq1RD4UVwMzvbNqKGPM6fyusG/t8fr1ILQ="}]},"directories":{}},"1.1.0":{"name":"vinyl-fs-fake","version":"1.1.0","description":"Vinyl adapter for the file system that accepts fakes","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"https://github.com/callumacrae/vinyl-fs-fake"},"keywords":["vinyl","file","fs","fake","mock","test"],"author":{"name":"Callum Macrae","email":"callum@macr.ae"},"license":"MIT","bugs":{"url":"https://github.com/callumacrae/vinyl-fs-fake/issues"},"homepage":"https://github.com/callumacrae/vinyl-fs-fake","dependencies":{"through2":"^0.6.3","vinyl":"^0.4.6","vinyl-fs":"^0.3.13"},"devDependencies":{"del":"^1.1.1","graceful-fs":"^3.0.5","mocha":"^2.1.0","should":"^5.0.0"},"gitHead":"da57c009c9783f7c600e778278d2855c464331cb","_id":"vinyl-fs-fake@1.1.0","_shasum":"05f1b142bacaa145c31fa138ce2fa0bfd68b5f02","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"callumacrae","email":"callum@macr.ae"},"maintainers":[{"name":"callumacrae","email":"callum@macr.ae"}],"dist":{"shasum":"05f1b142bacaa145c31fa138ce2fa0bfd68b5f02","tarball":"https://registry.npmjs.org/vinyl-fs-fake/-/vinyl-fs-fake-1.1.0.tgz","integrity":"sha512-umjMnlzpSAsn8GY1cXa9rr10TpFL+QS8PSo3nf2ZJrTzhO4VUzGngcF18/e0exWtrOaKF5bPwYjYir4qKWVr3w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDrXafDXj4xxIKVxlN6oXF+yOBJITKZFUWMtO8ds/2TjwIgQBzWqWevHAF6K2EvP5rsmfFIUNjgIQmPHngKGZ9KBQk="}]},"directories":{}},"1.1.1":{"name":"vinyl-fs-fake","version":"1.1.1","description":"Vinyl adapter for the file system that accepts fakes","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git+https://github.com/callumacrae/vinyl-fs-fake.git"},"keywords":["vinyl","file","fs","fake","mock","test"],"authors":["Callum Macrae <callum@macr.ae>","Níckolas Goline <nickolas.goline@gmail.com>"],"license":"MIT","bugs":{"url":"https://github.com/callumacrae/vinyl-fs-fake/issues"},"homepage":"https://github.com/callumacrae/vinyl-fs-fake","dependencies":{"through2":"^0.6.3","vinyl":"^0.4.6","vinyl-fs":"^2.4.4"},"devDependencies":{"del":"^1.2.1","graceful-fs":"^3.0.5","mocha":"^2.5.3","should":"^5.0.0"},"gitHead":"4f8c985a61b6b8baed8877298df0f45a0503ad41","_id":"vinyl-fs-fake@1.1.1","_npmVersion":"6.4.1","_nodeVersion":"8.9.1","_npmUser":{"name":"ngoline","email":"n@ngoline.com"},"dist":{"integrity":"sha512-FY1KYQwp4yRt2695GqppK9viJTysuH6n6ns3t94l3wYFJlyf7YHtqCdNZGrMrpC1yLZZlueTioiOsL/6lFHykw==","shasum":"eb2dcba6020e4723701d9e49be66d90ee063dcba","tarball":"https://registry.npmjs.org/vinyl-fs-fake/-/vinyl-fs-fake-1.1.1.tgz","fileCount":11,"unpackedSize":10357,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbu9MbCRA9TVsSAnZWagAA6PgP/0YqYieiACCyhgBmV6X/\npZ3ge7trQHhpSrxkASd1pX5OdQloB4xabzrkuFV2f7cGTwwu9Qk8aadc30+N\n2FwxDz5dMtSR9OtgXyGJ8pFXHX9OPnyKezHV3KNFQ537soYcjsmbUJ7E7OkY\nenHlL0GBVu6ZiaQ1FVnYb+VUbJJkgHdn+caxzE+SyjxpscVqfzg+OtQdjD8v\n6uB1hyE6ZUCxRs9agmDaLl8AiXp6RA04nblt6tSQx5UrxX7T1+dRBaCWT2ZY\ntnHNEFU7O5kEkX+xWJZBWT8GLcIHTGHX47d6k/bzmdqRVtewxRKbE256XZVf\n5A7Os6aXwhog+Bwv2rZ/+vc2YyopMsmq6CiufeMoOjaK7v+3kyoSzj+BAGyw\naWn5B3CmXJ13ar86jqwquiD8caV+HlISzAt0nVSdbJ0imjOzCxLIodErLjeG\nQJFyPzTVdumY9dtw4BFYNkfBMLZUi5ylqTxXUGRqmwLlJ7FRwIyUDXAT+rvA\ncR3H7BM093PR/kn64GudUhSFYQblOsCVMI8KG4/WkNzhQsOaOwBN01N0HnyJ\nzC6t5Iaal6HrcupCKnxsrtjle1PoZRiWEtmjN8B2lc+B/UYdh8uxy+0jjZbq\nevhLC6CVsKMjzvZQoL/XZjMNNpv8GCS5nywJ4mYhrmHmfR6AVR0STHLIlzTX\ngLzO\r\n=8K6j\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAdeW4kRhelyWXcLiRLP/20YQT6BOuSh62d5DuiDDFPIAiAhrV64z4C/RYhXXzzNKyxXIByXQo/lbPcJKQr6/8P3kQ=="}]},"maintainers":[{"email":"callum@macr.ae","name":"callumacrae"},{"email":"n@ngoline.com","name":"ngoline"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vinyl-fs-fake_1.1.1_1539035931041_0.18714796495042307"},"_hasShrinkwrap":false}},"readme":"# vinyl-fs-fake [![Build Status](https://travis-ci.org/callumacrae/vinyl-fs-fake.svg)](https://travis-ci.org/callumacrae/vinyl-fs-fake)\r\n\r\nA [vinyl] adapter that extends [vinyl-fs] to allow for easy debugging by\r\npassing in virtual files instead of globs, and calling a function instead of\r\nwriting to file.\r\n\r\n\r\n## Install\r\n\r\n```\r\n$ npm install vinyl-fs-fake\r\n```\r\n\r\n\r\n## Usage\r\n\r\nSay you have the following gulpfile:\r\n\r\n```js\r\nvar gulp = require('gulp');\r\nvar plugins = require('gulp-require-plugins')();\r\n\r\nvar options = {\r\n\tJS_SRC: 'assets/js/*.js',\r\n\tJS_DEST: 'dest'\r\n};\r\n\r\ngulp.task('default', function () {\r\n\tgulp.src(options.JS_SRC)\r\n\t\t.pipe(plugins.minify())\r\n\t\t.pipe(plugins.concat('app.js'))\r\n\t\t.pipe(gulp.dest(options.JS_DEST));\r\n});\r\n```\r\n\r\nIf you were using vinyl-fs-fake instead of vinyl-fs, you could test your task\r\nsimply by changing the value of the `options` object:\r\n\r\n```js\r\nvar gulp = require('gulp');\r\nvar vfsFake = require('vinyl-fs-fake');\r\nvar plugins = require('gulp-require-plugins')();\r\n\r\nvar options = {\r\n\tJS_SRC: 'assets/js/*.js',\r\n\tJS_DEST: 'dest'\r\n};\r\n\r\ngulp.task('default', function () {\r\n\tvfsFake.src(options.JS_SRC)\r\n\t\t.pipe(plugins.minify())\r\n\t\t.pipe(plugins.concat('app.js'))\r\n\t\t.pipe(vfsFake.dest(options.JS_DEST));\r\n});\r\n```\r\n\r\nThen, you can replace the options object:\r\n\r\n```js\r\nvar options = {\r\n\tJS_SRC: [\r\n\t\t{ path: 'test.js', contents: new Buffer('...') },\r\n\t\t{ path: 'test2.js', contents: new Buffer('...') }\r\n\t],\r\n\tJS_DEST: function (files) {\r\n\t\tassert.equals(files.length, 1);\r\n\t\tassert.equals(files[0].path, 'app.js');\r\n\t}\r\n};\r\n```\r\n\r\nAs it's just a wrapper around vinyl-fs, you can pretty much drop it straight\r\ninto your code and it will work without needing any actual thinking. Then, when\r\nyou're ready, you can write tests for your gulp tasks.\r\n\r\nThis is pretty much only useful if you\r\n[split your gulpfile into multiple files].\r\n\r\n\r\n### vfsFake.src\r\n\r\nIf you pass in a glob or an array of globs, it will be given to the src method\r\nof vinyl-fs and returned. Basically, it doesn't change that behaviour.\r\n\r\nIf you pass in an object representing a file, it'll be turned into a vinyl\r\nobject and piped down the stream. You can also give it a vinyl object directly,\r\nor an array of objects or vinyl objects.\r\n\r\nIn addition to the options accepted by the Vinyl file constructor, you can pass\r\nthe file content as a string, in which case it will be bufferized for you.\r\n\r\n### vfsFake.dest\r\n\r\nIf you pass in a path, it will be given to the dest method of vinyl-fs and\r\nreturned; again, it doesn't change that behaviour.\r\n\r\nHowever, you can now pass in a function which will be given a `files` array,\r\ncontaining all the files piped through:\r\n\r\n```js\r\n\t...\r\n\t.pipe(vfsFake.dest(function (files) {\r\n\t\tconsole.log(files[2].contents.toString('utf8'));\r\n\t});\r\n```\r\n\r\nIt won't touch the files, so you can carry on piping that to other stuff.\r\n\r\nYou can also give it a stream, if you really want. It'll act like\r\n`vfsFake.dest` just wasn't called at all, and the stream was just given to\r\n`.pipe()` directly.\r\n\r\n\r\n## License\r\n\r\nReleased under the MIT license.\r\n\r\n\r\n\r\n[vinyl]: https://github.com/wearefractal/vinyl\r\n[vinyl-fs]: https://github.com/wearefractal/vinyl-fs\r\n[split your gulpfile into multiple files]: http://macr.ae/article/splitting-gulpfile-multiple-files.html","maintainers":[{"email":"callum@macr.ae","name":"callumacrae"},{"email":"n@ngoline.com","name":"ngoline"}],"time":{"modified":"2022-06-28T17:30:38.895Z","created":"2015-02-13T15:37:53.284Z","1.0.0":"2015-02-13T15:37:53.284Z","1.1.0":"2015-03-24T10:03:33.708Z","1.1.1":"2018-10-08T21:58:51.201Z"},"homepage":"https://github.com/callumacrae/vinyl-fs-fake","keywords":["vinyl","file","fs","fake","mock","test"],"repository":{"type":"git","url":"git+https://github.com/callumacrae/vinyl-fs-fake.git"},"bugs":{"url":"https://github.com/callumacrae/vinyl-fs-fake/issues"},"license":"MIT","readmeFilename":"README.md"}