lib/middleware/submissions.js
function processFileResponse(req, res, next) {
  var fileDetails = req.appformsResultPayload.data;
  if (fileDetails.stream) {
    var headers = {};
    headers["Content-Type"] = fileDetails.type;//Setting the file content type. Mime types are set by the file handler.
    headers["Content-Disposition"] = "attachment; filename=" + fileDetails.name;
    res.writeHead(200, headers);
    fileDetails.stream.pipe(res);
    fileDetails.stream.resume(); //Unpausing the stream as it was paused by the file handler
  } else {
    return next('Error getting submitted file - result: ' + JSON.stringify(fileDetails));
  }
}
function processFileResponse(req, res, next) {
  var fileDetails = req.appformsResultPayload.data;
  if (fileDetails.stream) {
    var headers = {};
    headers["Content-Type"] = fileDetails.type;//Setting the file content type. Mime types are set by the file handler.
    headers["Content-Disposition"] = "attachment; filename=" + fileDetails.name;
    res.writeHead(200, headers);
    fileDetails.stream.pipe(res);
    fileDetails.stream.resume(); //Unpausing the stream as it was paused by the file handler
  } else {
    return next('Error getting submitted file - result: ' + JSON.stringify(fileDetails));
  }
}
function processFileResponse ( req , res , next ) { var fileDetails = req . appformsResultPayload . data ; if ( fileDetails . stream ) { var headers = { } ; headers [ "Content-Type" ] = fileDetails . type ; //Setting the file content type. Mime types are set by the file handler. headers [ "Content-Disposition" ] = "attachment; filename=" + fileDetails . name ; res . writeHead ( 200 , headers ) ; fileDetails . stream . pipe ( res ) ; fileDetails . stream . resume ( ) ; //Unpausing the stream as it was paused by the file handler } else { return next ( 'Error getting submitted file - result: ' + JSON . stringify ( fileDetails ) ) ; } }
Function for handling a file response. Used when loading files from a submission

@param req
@param res
@param next
Function for handling a file response . Used when loading files from a submission