streaming-cache
Advanced tools
+20
-2
@@ -171,3 +171,10 @@ 'use strict'; | ||
| stream._read = function () { | ||
| this.push(chunks.shift()); | ||
| var chunk = chunks.shift(); | ||
| if(!chunk){ | ||
| this.needRead = true; | ||
| } | ||
| else{ | ||
| this.push(chunk); | ||
| this.needRead = false; | ||
| } | ||
| } | ||
@@ -177,3 +184,9 @@ stream._write = function (chunk, encoding, next) { | ||
| emitters[key].emit('data', chunk); | ||
| chunks.push(chunk); | ||
| if(this.needRead){ | ||
| this.push(chunk); | ||
| } | ||
| else{ | ||
| chunks.push(chunk); | ||
| } | ||
| next(null, chunk); | ||
@@ -192,3 +205,8 @@ } | ||
| stream.on('finish', function () { | ||
| if(this.needRead){ | ||
| this.push(null); | ||
| } | ||
| else{ | ||
| chunks.push(null); | ||
| } | ||
| var c = self.cache.get(key); | ||
@@ -195,0 +213,0 @@ |
+1
-1
| { | ||
| "name": "streaming-cache", | ||
| "version": "0.3.0", | ||
| "version": "0.3.1", | ||
| "description": "Cache and replay NodeJS streams", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
307950
0.11%517
3.4%