         @sendError("No files attached")
     @inPorts.in.on 'disconnect', () =>
       @outPorts.file.disconnect() if @outPorts.file.isConnected()
+    @inPorts.in.on 'endgroup', () =>
+      return unless @outPorts.out.isAttached()
+      @outPorts.out.endGroup()
+    @inPorts.in.on 'disconnect', () =>
+      return unless @outPorts.out.isConnected()
+      @outPorts.out.disconnect()
 
   sendError: (msg) ->
     @error new Error msg

  sendFiles: (request) ->
    return unless @outPorts.file.isAttached()
    for name, obj of request.files
      @outPorts.file.send(obj)

exports.getComponent = -> new ReceiveFiles

noflo = require 'noflo'
express = require 'express'
uuid = require 'node-uuid'

class ReceiveFiles extends noflo.Component
  icon: 'files-o'
