/** * * @constructor * @param {shoutT} shout */ var ShoutStream = function(shout) { stream.Writable.call(this); this.shout = shout; }
function ResponseWriter(request, response){ if (!(this instanceof ResponseWriter)){ return new ResponseWriter(request, response); } this.request = request; this.response = response; stream.Writable.call(this, { objectMode : true }); }
function Cache(options) { stream.Writable.call(this, options); this._key = options.key; this._value = null; this.on('finish', function() { Cache.store[this._key] = this._value.toString(); }); }
test('writable stream', function (done) { var spy = sinon.spy() var writable = new stream.Writable() writable._write = function (chunk, encoding, next) { spy(JSON.parse(chunk.toString())) next() } nock('http://localhost') .get('/foo') .reply(200, {hello: 'world'}) var client = theon('http://localhost') .resource('foo') .path('/foo') .render() client.foo() .pipe(writable) .end(function (err, res) { expect(err).to.be.null expect(spy.args[0][0]).to.be.deep.equal({ hello: 'world' }) done() }) })
const converter = new stream.Writable(); const chunks = []; converter._write = function (chunk, enc, cb) {
return new Promise((resolve, reject) => { var output = [] const collect_output_stream = new stream.Writable({ write: (chunk, encoding, next) => { if (opts.verbose) {
class WriteStream extends stream.Writable{ constructor(){ super();
success = true; else if (streamType === 'writable' && value instanceof StreamModule.Writable){ success = true;
describe('Cli Stream:', () => { class WriteStream extends stream.Writable{ constructor(){ super();
return new Promise((resolve) => { const ghostPrettyStream = new PrettyStream({verbose: verbose}); const writeStream = new streams.Writable();
function WritStream() { stream.Writable.call(this); this._cached = new Buffer(''); }
function ToFileStream(){ stream.Writable.call(this,{objectMode:true}); /*other options are *highWaterMark - (the default is 16 kB) this controls the back-pressure limit. *decodeStrings(defaults to true) This enables the automatic decoding of strings into binary buffers before passing them to the _write() method. This otion is ignored in the object mode. */ }