stream-buffers
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -6,2 +6,2 @@ module.exports = { | ||
DEFAULT_CHUNK_SIZE: 1024 | ||
}; | ||
}; |
@@ -19,3 +19,3 @@ var stream = require("stream"), | ||
var encoding = null; | ||
this.readable = true; | ||
@@ -42,3 +42,3 @@ this.writable = false; | ||
if((size + amount) < buffer.length) | ||
if(amount < buffer.length) | ||
buffer.copy(buffer, 0, amount, size); | ||
@@ -49,3 +49,3 @@ size -= amount; | ||
this.size = function() { | ||
return size; | ||
return size; | ||
}; | ||
@@ -60,3 +60,3 @@ | ||
var factor = Math.ceil((incomingDataSize - (buffer.length - size)) / incrementAmount); | ||
var newBuffer = new Buffer(buffer.length + (incrementAmount * factor)); | ||
@@ -84,3 +84,3 @@ buffer.copy(newBuffer, 0, 0, size); | ||
}; | ||
this.pause = function() { | ||
@@ -92,3 +92,3 @@ if(sendData) { | ||
}; | ||
this.resume = function() { | ||
@@ -99,6 +99,6 @@ if(sendData && !sendData.interval) { | ||
}; | ||
this.destroy = function() { | ||
that.emit("end"); | ||
sendData.interval && clearTimeout(sendData.interval); | ||
if(sendData.interval) clearTimeout(sendData.interval); | ||
sendData = null; | ||
@@ -105,0 +105,0 @@ that.readable = false; |
module.exports = require("./constants"); | ||
module.exports.ReadableStreamBuffer = require("./readable_streambuffer"); | ||
module.exports.WritableStreamBuffer = require("./writable_streambuffer"); | ||
module.exports.WritableStreamBuffer = require("./writable_streambuffer"); |
@@ -25,7 +25,7 @@ var util = require("util"), | ||
}; | ||
this.maxSize = function() { | ||
return buffer.length; | ||
}; | ||
this.getContents = function(length) { | ||
@@ -36,3 +36,3 @@ if(!size) return false; | ||
buffer.copy(data, 0, 0, data.length); | ||
if(data.length < size) | ||
@@ -62,3 +62,3 @@ buffer.copy(buffer, 0, data.length); | ||
var factor = Math.ceil((incomingDataSize - (buffer.length - size)) / incrementAmount); | ||
var newBuffer = new Buffer(buffer.length + (incrementAmount * factor)); | ||
@@ -69,3 +69,3 @@ buffer.copy(newBuffer, 0, 0, size); | ||
}; | ||
this.write = function(data, encoding) { | ||
@@ -86,3 +86,3 @@ if(!that.writable) return; | ||
}; | ||
this.end = function() { | ||
@@ -93,3 +93,3 @@ var args = Array.prototype.slice.apply(arguments); | ||
}; | ||
this.destroySoon = this.destroy = function() { | ||
@@ -100,2 +100,2 @@ that.writable = false; | ||
}; | ||
util.inherits(WritableStreamBuffer, stream.Stream); | ||
util.inherits(WritableStreamBuffer, stream.Stream); |
{ | ||
"name": "stream-buffers", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Buffer-backed Streams for reading and writing.", | ||
@@ -17,3 +17,6 @@ "keywords": "memory streams, buffer streams", | ||
"url" : "https://github.com/samcday/node-stream-buffer.git" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "vows --spec" | ||
} | ||
} |
@@ -1,3 +0,5 @@ | ||
# Node Stream Buffers | ||
# Node Stream Buffers `v0.2.5` | ||
[![Build Status](https://travis-ci.org/samcday/node-stream-buffer.png)](https://travis-ci.org/samcday/node-stream-buffer) | ||
... For lack of a cooler (or less confusing) name. | ||
@@ -4,0 +6,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
12172
8
169
114
0