Socket
Socket
Sign inDemoInstall

string-stream

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.3 to 0.0.4

21

index.js

@@ -57,2 +57,23 @@ var Stream = require('stream'),

};
/**
* The write end to a stream buffer.
*/
function Writable() {
Writable.super_.call(this);
this._data = '';
}
inherits(Writable, Stream);
Writable.prototype.write = function (data) {
this._data += data;
};
Writable.prototype.end = function () {
this.write.apply(this, arguments);
this.emit('end');
};
Writable.prototype.toString = function () {
return this._data;
};
exports.Readable = Readable;
exports.Writable = Writable;

2

package.json
{
"name": "string-stream",
"version": "0.0.3",
"version": "0.0.4",
"description": "A stream that works on a string.",

@@ -5,0 +5,0 @@ "main": "index.js",

var Readable = require('..').Readable,
Writable = require('..').Writable,
Pipe = require('pipette').Pipe;

@@ -22,1 +23,11 @@ require('should');

});
describe('Writable stream', function () {
it('should write the given data', function (done) {
var stream = new Writable();
stream.on('end', function () {
stream.toString().should.equal('Test content');
done();
});
stream.end('Test content');
});
});
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc