1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- {
- "_args": [
- [
- {
- "raw": "delayed-stream@~1.0.0",
- "scope": null,
- "escapedName": "delayed-stream",
- "name": "delayed-stream",
- "rawSpec": "~1.0.0",
- "spec": ">=1.0.0 <1.1.0",
- "type": "range"
- },
- "/mnt/Data/bach/Documents/ola/OLA#4/OLA#4DOC/sys/node_modules/combined-stream"
- ]
- ],
- "_from": "delayed-stream@>=1.0.0 <1.1.0",
- "_id": "delayed-stream@1.0.0",
- "_inCache": true,
- "_location": "/delayed-stream",
- "_nodeVersion": "1.6.4",
- "_npmUser": {
- "name": "apechimp",
- "email": "apeherder@gmail.com"
- },
- "_npmVersion": "2.8.3",
- "_phantomChildren": {},
- "_requested": {
- "raw": "delayed-stream@~1.0.0",
- "scope": null,
- "escapedName": "delayed-stream",
- "name": "delayed-stream",
- "rawSpec": "~1.0.0",
- "spec": ">=1.0.0 <1.1.0",
- "type": "range"
- },
- "_requiredBy": [
- "/combined-stream"
- ],
- "_resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
- "_shasum": "df3ae199acadfb7d440aaae0b29e2272b24ec619",
- "_shrinkwrap": null,
- "_spec": "delayed-stream@~1.0.0",
- "_where": "/mnt/Data/bach/Documents/ola/OLA#4/OLA#4DOC/sys/node_modules/combined-stream",
- "author": {
- "name": "Felix Geisendörfer",
- "email": "felix@debuggable.com",
- "url": "http://debuggable.com/"
- },
- "bugs": {
- "url": "https://github.com/felixge/node-delayed-stream/issues"
- },
- "contributors": [
- {
- "name": "Mike Atkins",
- "email": "apeherder@gmail.com"
- }
- ],
- "dependencies": {},
- "description": "Buffers events from a stream until you are ready to handle them.",
- "devDependencies": {
- "fake": "0.2.0",
- "far": "0.0.1"
- },
- "directories": {},
- "dist": {
- "shasum": "df3ae199acadfb7d440aaae0b29e2272b24ec619",
- "tarball": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
- },
- "engines": {
- "node": ">=0.4.0"
- },
- "gitHead": "07a9dc99fb8f1a488160026b9ad77493f766fb84",
- "homepage": "https://github.com/felixge/node-delayed-stream",
- "license": "MIT",
- "main": "./lib/delayed_stream",
- "maintainers": [
- {
- "name": "felixge",
- "email": "felix@debuggable.com"
- },
- {
- "name": "apechimp",
- "email": "apeherder@gmail.com"
- }
- ],
- "name": "delayed-stream",
- "optionalDependencies": {},
- "readme": "# delayed-stream\n\nBuffers events from a stream until you are ready to handle them.\n\n## Installation\n\n``` bash\nnpm install delayed-stream\n```\n\n## Usage\n\nThe following example shows how to write a http echo server that delays its\nresponse by 1000 ms.\n\n``` javascript\nvar DelayedStream = require('delayed-stream');\nvar http = require('http');\n\nhttp.createServer(function(req, res) {\n var delayed = DelayedStream.create(req);\n\n setTimeout(function() {\n res.writeHead(200);\n delayed.pipe(res);\n }, 1000);\n});\n```\n\nIf you are not using `Stream#pipe`, you can also manually release the buffered\nevents by calling `delayedStream.resume()`:\n\n``` javascript\nvar delayed = DelayedStream.create(req);\n\nsetTimeout(function() {\n // Emit all buffered events and resume underlaying source\n delayed.resume();\n}, 1000);\n```\n\n## Implementation\n\nIn order to use this meta stream properly, here are a few things you should\nknow about the implementation.\n\n### Event Buffering / Proxying\n\nAll events of the `source` stream are hijacked by overwriting the `source.emit`\nmethod. Until node implements a catch-all event listener, this is the only way.\n\nHowever, delayed-stream still continues to emit all events it captures on the\n`source`, regardless of whether you have released the delayed stream yet or\nnot.\n\nUpon creation, delayed-stream captures all `source` events and stores them in\nan internal event buffer. Once `delayedStream.release()` is called, all\nbuffered events are emitted on the `delayedStream`, and the event buffer is\ncleared. After that, delayed-stream merely acts as a proxy for the underlaying\nsource.\n\n### Error handling\n\nError events on `source` are buffered / proxied just like any other events.\nHowever, `delayedStream.create` attaches a no-op `'error'` listener to the\n`source`. This way you only have to handle errors on the `delayedStream`\nobject, rather than in two places.\n\n### Buffer limits\n\ndelayed-stream provides a `maxDataSize` property that can be used to limit\nthe amount of data being buffered. In order to protect you from bad `source`\nstreams that don't react to `source.pause()`, this feature is enabled by\ndefault.\n\n## API\n\n### DelayedStream.create(source, [options])\n\nReturns a new `delayedStream`. Available options are:\n\n* `pauseStream`\n* `maxDataSize`\n\nThe description for those properties can be found below.\n\n### delayedStream.source\n\nThe `source` stream managed by this object. This is useful if you are\npassing your `delayedStream` around, and you still want to access properties\non the `source` object.\n\n### delayedStream.pauseStream = true\n\nWhether to pause the underlaying `source` when calling\n`DelayedStream.create()`. Modifying this property afterwards has no effect.\n\n### delayedStream.maxDataSize = 1024 * 1024\n\nThe amount of data to buffer before emitting an `error`.\n\nIf the underlaying source is emitting `Buffer` objects, the `maxDataSize`\nrefers to bytes.\n\nIf the underlaying source is emitting JavaScript strings, the size refers to\ncharacters.\n\nIf you know what you are doing, you can set this property to `Infinity` to\ndisable this feature. You can also modify this property during runtime.\n\n### delayedStream.dataSize = 0\n\nThe amount of data buffered so far.\n\n### delayedStream.readable\n\nAn ECMA5 getter that returns the value of `source.readable`.\n\n### delayedStream.resume()\n\nIf the `delayedStream` has not been released so far, `delayedStream.release()`\nis called.\n\nIn either case, `source.resume()` is called.\n\n### delayedStream.pause()\n\nCalls `source.pause()`.\n\n### delayedStream.pipe(dest)\n\nCalls `delayedStream.resume()` and then proxies the arguments to `source.pipe`.\n\n### delayedStream.release()\n\nEmits and clears all events that have been buffered up so far. This does not\nresume the underlaying source, use `delayedStream.resume()` instead.\n\n## License\n\ndelayed-stream is licensed under the MIT license.\n",
- "readmeFilename": "Readme.md",
- "repository": {
- "type": "git",
- "url": "git://github.com/felixge/node-delayed-stream.git"
- },
- "scripts": {
- "test": "make test"
- },
- "version": "1.0.0"
- }
|