{ "_args": [ [ { "raw": "match-stream@>= 0.0.2 < 1", "scope": null, "escapedName": "match-stream", "name": "match-stream", "rawSpec": ">= 0.0.2 < 1", "spec": ">=0.0.2 <1.0.0", "type": "range" }, "C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\unzip" ] ], "_from": "match-stream@>=0.0.2 <1.0.0", "_id": "match-stream@0.0.2", "_inCache": true, "_location": "/match-stream", "_npmUser": { "name": "evanoxfeld", "email": "eoxfeld@gmail.com" }, "_npmVersion": "1.2.17", "_phantomChildren": {}, "_requested": { "raw": "match-stream@>= 0.0.2 < 1", "scope": null, "escapedName": "match-stream", "name": "match-stream", "rawSpec": ">= 0.0.2 < 1", "spec": ">=0.0.2 <1.0.0", "type": "range" }, "_requiredBy": [ "/unzip" ], "_resolved": "https://registry.npmjs.org/match-stream/-/match-stream-0.0.2.tgz", "_shasum": "99eb050093b34dffade421b9ac0b410a9cfa17cf", "_shrinkwrap": null, "_spec": "match-stream@>= 0.0.2 < 1", "_where": "C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\unzip", "author": { "name": "Evan Oxfeld", "email": "eoxfeld@gmail.com" }, "bugs": { "url": "https://github.com/EvanOxfeld/match-stream/issues" }, "dependencies": { "buffers": "~0.1.1", "readable-stream": "~1.0.0" }, "description": "Match a pattern within a stream", "devDependencies": { "stream-buffers": "~0.2.4", "tap": "~0.4.0" }, "directories": { "example": "examples", "test": "test" }, "dist": { "shasum": "99eb050093b34dffade421b9ac0b410a9cfa17cf", "tarball": "https://registry.npmjs.org/match-stream/-/match-stream-0.0.2.tgz" }, "gitHead": "665dabbb0a3593310012eb041fc07395db632a20", "homepage": "https://github.com/EvanOxfeld/match-stream#readme", "keywords": [ "match", "stream", "split" ], "license": "MIT", "main": "match.js", "maintainers": [ { "name": "evanoxfeld", "email": "eoxfeld@gmail.com" } ], "name": "match-stream", "optionalDependencies": {}, "readme": "match-stream [![Build Status](https://travis-ci.org/EvanOxfeld/match-stream.png)](https://travis-ci.org/EvanOxfeld/match-stream)\n============\n\nSupply a function to handle pattern matches within a NodeJS stream.\n\n## Installation\n\n```bash\n$ npm install match-stream\n```\n\n## Quick Examples\n\n### End stream on match\n\n```javascript\nvar MatchStream = require('match-stream');\nvar streamBuffers = require(\"stream-buffers\");\n\nvar ms = new MatchStream({ pattern: 'World'}, function (buf, matched, extra) {\n if (!matched) {\n return this.push(buf);\n }\n this.push(buf);\n return this.push(null); //signal end of data\n});\n\nvar sourceStream = new streamBuffers.ReadableStreamBuffer();\nsourceStream.put(\"Hello World\");\nvar writableStream = new streamBuffers.WritableStreamBuffer();\n\nsourceStream\n .pipe(ms)\n .pipe(writableStream)\n .once('close', function () {\n var str = writableStream.getContentsAsString('utf8');\n console.log('Piped data before pattern occurs:', \"'\" + str + \"'\");\n sourceStream.destroy();\n });\n\n//Output\n//Piped data before pattern occurs: 'Hello '\n```\n\n### Split stream\n\n```javascript\nvar MatchStream = require('match-stream');\nvar fs = require('fs');\n\nvar line = \"\";\nvar loremLines = [];\nvar ms = new MatchStream({ pattern: '.', consume: true}, function (buf, matched, extra) {\n line += buf.toString();\n if (matched) {\n loremLines.push(line.trim());\n line = \"\";\n }\n});\n\nfs.createReadStream('lorem.txt')\n .pipe(ms)\n .once('finish', function() {\n console.log(loremLines);\n });\n```\n\n## License\n\nMIT\n\n## Acknowledgements\n\nSpecial thanks to @wanderview for assisting with the API.\n\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/EvanOxfeld/match-stream.git" }, "scripts": { "test": "./node_modules/.bin/tap ./test/*.js" }, "version": "0.0.2" }