{“ast”:null,“code”:“// Copyright Joyent, Inc. and other Node contributors.n//n// Permission is hereby granted, free of charge, to any person obtaining an// copy of this software and associated documentation files (then// "Software"), to deal in the Software without restriction, includingn// without limitation the rights to use, copy, modify, merge, publish,n// distribute, sublicense, and/or sell copies of the Software, and to permitn// persons to whom the Software is furnished to do so, subject to then// following conditions:n//n// The above copyright notice and this permission notice shall be includedn// in all copies or substantial portions of the Software.n//n// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSn// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFn// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. INn// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT ORn// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THEn// USE OR OTHER DEALINGS IN THE SOFTWARE.nmodule.exports = Stream;nnvar EE = require('events').EventEmitter;nnvar inherits = require('inherits');nninherits(Stream, EE);nStream.Readable = require('readable-stream/readable.js');nStream.Writable = require('readable-stream/writable.js');nStream.Duplex = require('readable-stream/duplex.js');nStream.Transform = require('readable-stream/transform.js');nStream.PassThrough = require('readable-stream/passthrough.js'); // Backwards-compat with node 0.4.xnnStream.Stream = Stream; // old-style streams. Note that the pipe method (the only relevantn// part of this class) is overridden in the Readable class.nnfunction Stream() {n EE.call(this);n}nnStream.prototype.pipe = function (dest, options) {n var source = this;nn function ondata(chunk) {n if (dest.writable) {n if (false === dest.write(chunk) && source.pause) {n source.pause();n }n }n }nn source.on('data', ondata);nn function ondrain() {n if (source.readable && source.resume) {n source.resume();n }n }nn dest.on('drain', ondrain); // If the 'end' option is not supplied, dest.end() will be called whenn // source gets the 'end' or 'close' events. Only dest.end() once.nn if (!dest._isStdio && (!options || options.end !== false)) {n source.on('end', onend);n source.on('close', onclose);n }nn var didOnEnd = false;nn function onend() {n if (didOnEnd) return;n didOnEnd = true;n dest.end();n }nn function onclose() {n if (didOnEnd) return;n didOnEnd = true;n if (typeof dest.destroy === 'function') dest.destroy();n } // don't leave dangling pipes when there are errors.nnn function onerror(er) {n cleanup();nn if (EE.listenerCount(this, 'error') === 0) {n throw er; // Unhandled stream error in pipe.n }n }nn source.on('error', onerror);n dest.on('error', onerror); // remove all the event listeners that were added.nn function cleanup() {n source.removeListener('data', ondata);n dest.removeListener('drain', ondrain);n source.removeListener('end', onend);n source.removeListener('close', onclose);n source.removeListener('error', onerror);n dest.removeListener('error', onerror);n source.removeListener('end', cleanup);n source.removeListener('close', cleanup);n dest.removeListener('close', cleanup);n }nn source.on('end', cleanup);n source.on('close', cleanup);n dest.on('close', cleanup);n dest.emit('pipe', source); // Allow for unix-like usage: A.pipe(B).pipe(C)nn return dest;n};”,“map”:null,“metadata”:{},“sourceType”:“module”}