End the stream

@param {Function} cb Callback
346529
function endStream(cb) {
        // If no files were passed in, no files go out ...
        if (!latestFile || (Object.keys(concats).length === 0 && concats.constructor === Object)) {
            cb();
            return;
        }

        // Prepare a method for pushing the stream
        const pushJoinedFile = (joinedBase) => {
            const joinedFile = new File({
                path: joinedBase,
                contents: concats[joinedBase].concat.content,
                stat: concats[joinedBase].stats
            });
            if (concats[joinedBase].concat.sourceMapping) {
                joinedFile.sourceMap = JSON.parse(concats[joinedBase].concat.sourceMap);
            }
            this.push(joinedFile);
            delete concats[joinedBase];
        };

        // Refine the dependency graph
        const refinedDependencyMap = [];
        dependencyGraph.forEach(edge => {
            if ((edge[0] in nameBaseMap) && (edge[1] in nameBaseMap)) {
                refinedDependencyMap.push([nameBaseMap[edge[0]], nameBaseMap[edge[1]]]);
            }
        });
        const sortedDependencies = refinedDependencyMap.length ? toposort(refinedDependencyMap).reverse() : [];
        sortedDependencies.map(pushJoinedFile);

        // Run through all registered contact instances
        for (const targetBase in concats) {
            pushJoinedFile(targetBase);
        }
        cb();
    }
211119
def close_stream(self):
		
		self.keep_listening = False
		self.stream.stop()
		self.stream.close()
39448
function off(event, callback) {
    if (callback) {
      listeners[event].splice(listeners[event].indexOf(callback), 1);
    }
    else {
      listeners[event] = [];
    }
  }
1028525
function (connectionName, cb) {
            var closeConnection = function (connectionName) {
                var connection = me.connections[connectionName];
                if (connection) {
                    if (connection.conn && typeof connection.conn.close === 'function') {
                        connection.conn.close(function (err) {
                            if (err) console.error(err);
                        });
                    }
                    else {
                        connection.close(function (err) {
                            if (err) console.error(err);
                        });
                    }
                }

                delete me.connections[connectionName];
            };

            if (connectionName) closeConnection(connectionName);
            else _.each(me.connections, closeConnection);

            return cb();
        }
922764
public function stream_close() {
    assert(isset($this->client));
    $this->client->close();
    $this->client = null;
  }
59778
function _abort(err) {
  this._queue = null;
  this._commands = null;
  // listen for the event so we can clean reference
  function onError() {
    this._client = null;
  }
  this._client.once('error', onError.bind(this));
  this._client.emit('error', err);
}
1162591
function close() {
		if ( error ) {
			debug( 'Stream was destroyed due to an error. Error: %s.', JSON.stringify( error ) );
			self.emit( 'error', error );
		}
		debug( 'Closing the stream...' );
		self.emit( 'close' );
	}
316042
function finish(cb) {
      clearTimeout(timer);
      timer = null;
      return subscriber.unsubscribe(
        'message/' + id + '/' + getIndex, cb);
    }
525008
function stopRelay(cb) {
        var self = this;

        if (!this.control && !this.process) {
            return cb();
        }

        this.control.signalShutdown(function (err) {
            if (err) {
                return cb(err);
            }
            self.process.on('exit', function () {
                /**
                 * @callback TorRelay~stopCallback
                 * @param {null| error} error - Error if there was one
                 */
                return cb();
            });
        });
        return this;
    }
1037775
public void close(final AVIMClientCallback callback) {
    final AVIMClientCallback internalCallback = new AVIMClientCallback() {
      @Override
      public void done(AVIMClient client, AVIMException e) {
        if (null == e) {
          AVIMClient.this.localClose();
        }
        if (null != callback) {
          callback.done(client, e);
        }
      }
    };
    InternalConfiguration.getOperationTube().closeClient(this.clientId, internalCallback);
  }
857047
function consumeStream(stream, callback) {
    var chunks = [];
    stream.on("data", onData);
    stream.on("end", onEnd);
    stream.on("error", onError);
    function onData(chunk) {
        chunks.push(chunk);
    }
    function onEnd() {
        cleanup();
        callback(null, chunks.join(""));
    }
    function onError(err) {
        cleanup();
        callback(err);
    }
    function cleanup() {
        stream.removeListener("data", onData);
        stream.removeListener("end", onEnd);
        stream.removeListener("error", onError);
    }
}
800216
function(cb) {
          var opts = {
            url: uri + 'user/stream',
            method: 'GET',
            qs: qs,
            json: true
          };
          request(opts,function(e,r,b) {
            if (e) cb(e)
            else {
              if (r.statusCode==200) cb(null, b)
              else {
                cb({statusCode:r.statusCode,error:b.error})
              }
            }
          });
        }
1055249
function TcpStreamEnd () {
        this.simulator.Debug (3,"TcpStream [%s:%s] connection ended", simulator.opts.host, simulator.opts.port);
        delete ActiveClients[this];
        setTimeout (function(){ // wait for timeout and recreate a new Object from scratch
            simulator.TcpClient ();
        }, this.opts.timeout);
    }
205171
function endListener(state) {
    // Note:  If incremental is conclusive for 'end' event, this will be called
    // with isDone === true, since removeListener doesn't affect listeners for
    // an event which is already in-progress.
    if (state.ended || isDone) {
      return;
    }

    state.ended = true;
    ended += 1;

    debug(`${streamName(this)} has ended.`);

    if (options.incremental) {
      if (doCompare(options.incremental, CompareType.incremental)) {
        return;
      }
    }

    if (ended === 2) {
      const postEndCompare = function() {
        doCompare(options.compare, CompareType.last);
      };
      if (options.delay) {
        debug(`All streams have ended.  Delaying for ${options.delay
        }ms before final compare.`);
        postEndTimeout = setTimeout(postEndCompare, options.delay);
      } else {
        // Let pending I/O and callbacks complete to catch some errant events
        debug('All streams have ended.  Delaying before final compare.');
        postEndImmediate = setImmediate(postEndCompare);
      }
    }
  }
261554
function long(callback) {
  var called = false

  return function cbOnceLater() {
    var args

    if (called) {
      return
    }

    called = true
    args = Array.prototype.slice.call(arguments)

    process.nextTick(function () {
      callback.apply(null, args)
    })
  }
}
924060
function end() {
  var group = stack.pop();
  if (!requests) return;
  var data = JSON.stringify(requests);
  var dest = path.join(options.fixtures, group + '.json');
  fs.writeFileSync(dest, data, 'utf8');
  requests = null;
}
241199
function end() {
		var err
		var args = Array.prototype.slice.call(arguments)
		var cb = typeof args[args.length - 1] === 'function' ? args.pop() : null
		if (self.writable && args.length) write.apply(this, args.concat(afterWrite))
		else afterWrite()

		function afterWrite(e) {
			if (e) err = e
			destroy(afterDestroy)
		}

		function afterDestroy(e) {
			if (e && !err) err = e
			if (cb) {
				var cbArgs = []
				if (err) cbArgs.push(err)
				cb.apply(this, cbArgs)
			}
		}
	}