Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stream-buffers

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-buffers - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

coverage/coverage.json

45

lib/readable_streambuffer.js

@@ -24,22 +24,25 @@ var stream = require("stream"),

var sendData = function() {
if(!size) {
that.emit("end");
return;
var amount = Math.min(chunkSize, size);
if (amount > 0) {
var chunk = null;
if(encoding) {
chunk = buffer.toString(encoding, 0, amount);
}
else {
chunk = new Buffer(amount);
buffer.copy(chunk, 0, 0, amount);
}
that.emit("data", chunk);
if(amount < buffer.length)
buffer.copy(buffer, 0, amount, size);
size -= amount;
}
var amount = Math.min(chunkSize, size);
var chunk = null;
if(encoding) {
chunk = buffer.toString(encoding, 0, amount);
if(size === 0 && !that.readable) {
that.emit("end");
that.emit("close");
}
else {
chunk = new Buffer(amount);
buffer.copy(chunk, 0, 0, amount);
}
that.emit("data", chunk);
if(amount < buffer.length)
buffer.copy(buffer, 0, amount, size);
size -= amount;
};

@@ -111,2 +114,10 @@

this.destroySoon = function() {
that.readable = false;
if (!sendData.interval) {
that.emit("end");
that.emit("close");
}
};
this.setEncoding = function(_encoding) {

@@ -113,0 +124,0 @@ encoding = _encoding;

{
"name": "stream-buffers",
"version": "1.0.1",
"version": "1.1.0",
"description": "Buffer-backed Streams for reading and writing.",

@@ -17,2 +17,3 @@ "keywords": [

"devDependencies": {
"istanbul": "~0.3.2",
"vows": ">= 0.5.6"

@@ -25,7 +26,4 @@ },

"scripts": {
"test": "vows --spec"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
"test": "[ -n \"$NO_COVERAGE\" ] && vows --spec || istanbul cover vows -- --spec"
}
}
# Node Stream Buffers
[![Build Status](http://img.shields.io/travis/samcday/node-stream-buffer.svg?style=flat-square)](https://travis-ci.org/samcday/node-stream-buffer)
[![Code Climate](http://img.shields.io/codeclimate/github/samcday/node-stream-buffer.svg?style=flat-square)](https://codeclimate.com/github/samcday/node-stream-buffer)
[![Build Status][badge-travis-img]][badge-travis-url]
[![Code Climate][badge-climate-img]][badge-climate-url]
[![Code Coverage][badge-coverage-img]][badge-coverage-url]
... For lack of a cooler (or less confusing) name.
Simple Readable and Writable Streams that use a [Buffer][node-buffer-docs] to store received data, or for data to send out. Useful for test code, debugging, and a wide range of other utilities.
Simple Readable and Writable Streams that use a Buffer to store received data, or for data to send out. Pretty much to be used for automated test-cases or debugging.
[![NPM](https://nodei.co/npm/stream-buffers.png)](https://npmjs.org/package/stream-buffers)
## Installation
It's on NPM.
[![NPM][badge-npm-img]][badge-npm-url]
npm install stream-buffers
## Usage

@@ -127,1 +122,12 @@

node-stream-buffer is free and unencumbered public domain software. For more information, see the accompanying UNLICENSE file.
[badge-travis-img]: http://img.shields.io/travis/samcday/node-stream-buffer.svg?style=flat-square
[badge-travis-url]: https://travis-ci.org/samcday/node-stream-buffer
[badge-climate-img]: http://img.shields.io/codeclimate/github/samcday/node-stream-buffer.svg?style=flat-square
[badge-climate-url]: https://codeclimate.com/github/samcday/node-stream-buffer
[badge-coverage-img]: http://img.shields.io/codeclimate/coverage/github/samcday/node-stream-buffer.svg?style=flat-square
[badge-coverage-url]: https://codeclimate.com/github/samcday/node-stream-buffer
[badge-npm-img]: https://nodei.co/npm/stream-buffers.png?downloads=true&downloadRank=true&stars=true
[badge-npm-url]: https://npmjs.org/package/stream-buffers
[node-buffer-docs]: http://nodejs.org/api/buffer.html

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc