{"_id":"process-files","_rev":"7-89f5920cbe0c03de597087f880ee5b42","name":"process-files","description":"Read files and process the contents","dist-tags":{"latest":"1.0.0"},"versions":{"0.1.0":{"name":"process-files","version":"0.1.0","description":"Read files and process the contents","author":{"name":"Tyler Akins","email":"fidian@rumkin.com"},"homepage":"https://github.com/tests-always-included/process-files","bugs":{"url":"https://github.com/tests-always-included/process-files/issues"},"contributors":[{"name":"Tyler Akins","email":"fidian@rumkin.com","url":"http://rumkin.com"}],"main":"lib/process-files.js","repository":{"type":"git","url":"https://github.com/tests-always-included/process-files.git"},"keywords":["command-line","content","contents","file","files","process","stdin"],"devDependencies":{"grunt":"~0.4.1","grunt-cli":"*","grunt-jasmine-node":"*","grunt-jslint":"*"},"license":"MIT","scripts":{"test":"grunt test"},"gitHead":"6ea5637fa0a3168e3d4e4be14bac7f12a299f773","_id":"process-files@0.1.0","_shasum":"6d573fa3490d5b380b9424bf872a43436b8a5d5a","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"fidian","email":"fidian@rumkin.com"},"maintainers":[{"name":"fidian","email":"fidian@rumkin.com"}],"dist":{"shasum":"6d573fa3490d5b380b9424bf872a43436b8a5d5a","tarball":"https://registry.npmjs.org/process-files/-/process-files-0.1.0.tgz","integrity":"sha512-jT5SvMWG+pEzKeS2aVkDC2VOORTKsar7/MZWR2PEmOHi7my4ehCRee70Lr5A3WSZYPzLG9r7X/0VZ0sT9HWL5Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCpLAziwMYymSVaVB3YcIUGlbbq0MudE6m45fqzFD4MGAIhAJjVl4syx+N8zJj8KGjppK4B6cVzNJD+0R0rTHHzzWPn"}]}},"0.1.1":{"name":"process-files","version":"0.1.1","description":"Read files and process the contents","author":{"name":"Tyler Akins","email":"fidian@rumkin.com"},"homepage":"https://github.com/tests-always-included/process-files","bugs":{"url":"https://github.com/tests-always-included/process-files/issues"},"contributors":[{"name":"Tyler Akins","email":"fidian@rumkin.com","url":"http://rumkin.com"}],"main":"lib/process-files.js","repository":{"type":"git","url":"https://github.com/tests-always-included/process-files.git"},"keywords":["command-line","content","contents","file","files","process","stdin"],"devDependencies":{"grunt":"~0.4.1","grunt-cli":"*","grunt-jasmine-node":"*","grunt-jslint":"*"},"license":"MIT","scripts":{"test":"grunt test"},"gitHead":"88e666af0ec7f77ad2a9ee68a6b3ec12f6bd2b90","_id":"process-files@0.1.1","_shasum":"f94d95673f0291d0792f6f72bc7921fcddf60072","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"fidian","email":"fidian@rumkin.com"},"maintainers":[{"name":"fidian","email":"fidian@rumkin.com"}],"dist":{"shasum":"f94d95673f0291d0792f6f72bc7921fcddf60072","tarball":"https://registry.npmjs.org/process-files/-/process-files-0.1.1.tgz","integrity":"sha512-0mK92mb3pAFBPrD5Cto3+HCAyxcQZutmFLT9PDVr5LQ/rdRLrs4Gy7bQ/7lb9EyZYUGdGoFxlo5RFxrDaVGurw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCZKk6K1DAj09wNhB+9OeWcqrp+7fg6D2cskLb4oREygAIgP+nUBrE+pKQwAw2pMeDk5RCNeNny4aLWkgr6zWDDjcs="}]}},"1.0.0":{"name":"process-files","version":"1.0.0","description":"Read files and process the contents","author":{"name":"Tyler Akins","email":"fidian@rumkin.com"},"homepage":"https://github.com/tests-always-included/process-files","bugs":{"url":"https://github.com/tests-always-included/process-files/issues"},"contributors":[{"name":"Tyler Akins","email":"fidian@rumkin.com","url":"http://rumkin.com"}],"main":"lib/process-files.js","repository":{"type":"git","url":"git+https://github.com/tests-always-included/process-files.git"},"keywords":["command-line","content","contents","file","files","process","stdin"],"devDependencies":{"grunt":"~0.4.1","grunt-cli":"*","grunt-jasmine-node":"*","grunt-jslint":"*"},"license":"MIT","scripts":{"test":"grunt test"},"gitHead":"ef5faa23b3e866c6e59a8811e38ab673d3c27cb0","_id":"process-files@1.0.0","_shasum":"2d1ab8487675221841aa2bfdf22085614d588f23","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"fidian","email":"fidian@rumkin.com"},"dist":{"shasum":"2d1ab8487675221841aa2bfdf22085614d588f23","tarball":"https://registry.npmjs.org/process-files/-/process-files-1.0.0.tgz","integrity":"sha512-0hxz8bXkV3zO9yi5gausGcagj6iaUK4cZsK9OeL8ekVWkXuD0SC/1iE1cJntRxFWGNpZCc/hjYhc7XCwz8WuWQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIECd1RVhOYk1r5zmYpr7BY4PimtOw9+/8Kc21t31gvvhAiEA5BYaKun+x09Nhnw/TO+hgBQ9yWdbe+0nc+sTv1i+BFc="}]},"maintainers":[{"name":"fidian","email":"fidian@rumkin.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/process-files-1.0.0.tgz_1484087720962_0.735047388356179"}}},"readme":"processFiles\n============\n\nThis library helps you process files, especially for command-line programs.  It accepts a filename or an `Array` of filenames and will read the files sequentially.  When the content loads for a file, your callback will be called.  Has built-in support for reading from stdin, both when passed no files to load and when passed \"-\", per many Unix/Linux commands.\n\n[![npm version][npm-badge]][npm-link]\n[![Build Status][travis-badge]][travis-link]\n[![Dependencies][dependencies-badge]][dependencies-link]\n[![Dev Dependencies][devdependencies-badge]][devdependencies-link]\n\n\nUsage\n-----\n\nUse `npm` to install this package.\n\n```bash\nnpm install --save process-files\n```\n\nNext you need a bit of JavaScript.  Let's say you want to just load up two files and display them to the screen.\n\n```js\nvar processFiles = require('process-files');\n\nprocessFiles([\n    'file1.txt',\n    'file2.txt'\n], function (err, data, filename) {\n    // Check for errors\n    if (err) {\n        // When errors are passed, `data` and `filename` are undefined.\n        console.error('Error reading ' + err.filename, err.toString());\n    }\n\n    console.log('Contents of ' + filename);\n    console.log(data);\n});\n```\n\n\nExamples\n--------\n\nThis library is geared for use in a program that uses the command line.  When a filename of `-` is specified there, typically programs use stdin, such as `cat - > test.txt` would take all input and write it to `test.txt`.\n\n```js\nprocessFiles('-', function (err, data) {\n    if (err) {\n        console.error('Error', err.toString());\n    } else {\n        console.log(data)\n    }\n});\n```\n\nWhen passed an empty list of files or when passed the file `-`, standard input is automatically read.\n\n```\nprocessFiles(function (err, data, filename) {\n    // Even though no files were listed, this reads from stdin.\n    console.log(data);\n    // The file is always '-' when reading from stdin\n    console.log('Filename: ' + filename);  // \"Filename: -\"\n});\n```\n\nNeed to work with data asynchronously?  Not a problem.  You have two choices.\n\n```js\n// \"done\" callback\nprocessFiles(arrayOfFiles, function (err, data, filename, done) {\n    // Make text more 1337 for those h4ck3rs.\n    data = data.replace(/e/ig, '3');\n    data = data.replace(/l/ig, '1');\n    data = data.replace(/a/ig, '4');\n    data = data.replace(/t/ig, '7');\n    fs.writeFile(filename, data, done);\n});\n\n// Promises\nprocessFiles(arrayOfFiles, function (err, data, filename) {\n    var promise, resolver;\n\n    promise = new Promise(function (resolve) {\n        setTimeout(resolve, 30000);  // 30 second delay\n    });\n\n    return promise;\n});\n```\n\nThat's all fine and good, but how do I know that I am done with the list of files?  How about another callback?\n\n```js\nprocessFiles(arrayOfFiles, function (err, data, filename) {\n    // This is where you would process files\n}, function () {\n    console.log('All done processing files');\n});\n```\n\nYou can also specify options.\n\n```js\nprocessFiles(arrayOfFiles, {\n    encoding: 'utf8'\n}, function (err, data, filename) {\n    // Process file content here\n});\n```\n\n\nprocessFiles([files], [options], callback, [completionCallback])\n----------------------------------------------------------------\n\nThe library only exports this one function.  Parameters are detailed below.\n\n\n### files\n\nThis can be a single string filename, an array of filenames, or omitted.  When omitted or an empty array is passed, stdin is read instead.\n\nIf there is a file of \"-\", then stdin is read instead for that one file.\n\n\n### options\n\nOptions object.\n\n* `encoding` - Specify the type of file encoding for input files.  Defaults to `\"utf8\"`.\n\n\n### callback(err, data, filename, [done])\n\nCallback to execute when the file's content is loaded.\n\nWhen a fourth parameter is specified, then `processFiles` will wait until the `done` callback is called.\n\nWhen fewer than four parameters are specified, the callback may return a promise.  File loading will be suspended until the promise is resolved or rejected.  If anything other than a promise is returned or if there was no returned value, processing will continue immediately.\n\n\n### completionCallback()\n\nNo data is passed to the completion callback.  It is executed when `processFiles` is done processing all files.\n\n\nDevelopment\n-----------\n\nIf you want to work on this library, you need to check out the repository and run `npm install` to get the dependencies.\n\nTests are *always* included.  Make sure tests cover your changes.  To run the current tests, just use `npm test` or `grunt test` (they will run the same test suite).\n\n\nLicense\n-------\n\nThis software is licensed under an [MIT license with an additional non-advertising clause](LICENSE.md).\n\n[dependencies-badge]: https://img.shields.io/david/tests-always-included/process-files.svg\n[dependencies-link]: https://david-dm.org/tests-always-included/process-files\n[devdependencies-badge]: https://img.shields.io/david/dev/tests-always-included/process-files.svg\n[devdependencies-link]: https://david-dm.org/tests-always-included/process-files#info=devDependencies\n[LICENSE]: LICENSE.md\n[npm-badge]: https://img.shields.io/npm/v/process-files.svg\n[npm-link]: https://npmjs.org/package/process-files\n[travis-badge]: https://img.shields.io/travis/tests-always-included/process-files/master.svg\n[travis-link]: http://travis-ci.org/tests-always-included/process-files\n","maintainers":[{"name":"fidian","email":"fidian@rumkin.com"}],"time":{"modified":"2022-06-24T16:58:53.138Z","created":"2014-10-07T15:35:04.208Z","0.1.0":"2014-10-07T15:35:04.208Z","0.1.1":"2014-10-07T15:44:01.755Z","1.0.0":"2017-01-10T22:35:22.864Z"},"homepage":"https://github.com/tests-always-included/process-files","keywords":["command-line","content","contents","file","files","process","stdin"],"repository":{"type":"git","url":"git+https://github.com/tests-always-included/process-files.git"},"contributors":[{"name":"Tyler Akins","email":"fidian@rumkin.com","url":"http://rumkin.com"}],"author":{"name":"Tyler Akins","email":"fidian@rumkin.com"},"bugs":{"url":"https://github.com/tests-always-included/process-files/issues"},"license":"MIT","readmeFilename":"README.md"}