function DecodeStream(contentType, schema) { this.contentType = contentType; this.schema = schema; Transform.call(this, { readableObjectMode: true }); }
write (chunk, enc, done) { content += chunk.toString() done() }
stringWritable.on('finish', () => console.log(content))
function ReadStream (iterator, options) { if (!(this instanceof ReadStream)) return new ReadStream(iterator, options) options = options || {} Readable.call(this, extend(options, { objectMode: true })) this._iterator = iterator this._options = options this.on('end', this.destroy.bind(this, null, null)) }
//var out = new PassThrough(); this.request(sql).on('error', function (e) { out.emit('error', e); }).on('headers', function (e) { out.emit('headers', e); }).on('code', function (e) { if (e > 299) { var data = []; this.on('data', function (d) { data.push(d); }).on('finish', function () { var err = Buffer.concat(data).toString(); debugrs(err); debugrs(sql); out.emit('error', new Error(err)); }); } else { this.pipe(out); } out.emit('code', e); });
read () { this.push(Math.random() + '\n') }