lib/impl/importForms/unzipFile.js
function streamFileEntry(params, callback) {
  params.zipfile.openReadStream(params.entry, function(err, readStream) {
    if (err) {
      return callback(err);
    }
    // ensure parent directory exists
    var newFilePath = params.workingDir + "/" + params.entry.fileName;
    mkdirp(path.dirname(newFilePath), function(err) {
      if (err) {
        logger.debug("Error making directory " + newFilePath, err);
        return callback(err);
      }
      readStream.pipe(fs.createWriteStream(newFilePath));
      readStream.on("end", function() {
        params.zipfile.readEntry();
        callback();
      });
      readStream.on('error', function(err) {
        callback(err);
      });
    });
  });
}
function streamFileEntry(params, callback) {
  params.zipfile.openReadStream(params.entry, function(err, readStream) {
    if (err) {
      return callback(err);
    }
    // ensure parent directory exists
    var newFilePath = params.workingDir + "/" + params.entry.fileName;
    mkdirp(path.dirname(newFilePath), function(err) {
      if (err) {
        logger.debug("Error making directory " + newFilePath, err);
        return callback(err);
      }
      readStream.pipe(fs.createWriteStream(newFilePath));
      readStream.on("end", function() {
        params.zipfile.readEntry();
        callback();
      });
      readStream.on('error', function(err) {
        callback(err);
      });
    });
  });
}
function streamFileEntry ( params , callback ) { params . zipfile . openReadStream ( params . entry , function ( err , readStream ) { if ( err ) { return callback ( err ) ; } // ensure parent directory exists var newFilePath = params . workingDir + "/" + params . entry . fileName ; mkdirp ( path . dirname ( newFilePath ) , function ( err ) { if ( err ) { logger . debug ( "Error making directory " + newFilePath , err ) ; return callback ( err ) ; } readStream . pipe ( fs . createWriteStream ( newFilePath ) ) ; readStream . on ( "end" , function ( ) { params . zipfile . readEntry ( ) ; callback ( ) ; } ) ; readStream . on ( 'error' , function ( err ) { callback ( err ) ; } ) ; } ) ; } ) ; }
streamFileEntry - Streaming a single uncompressed file from the zip file to the working folder.

The folder structure of the zip file is maintained.

@param  {object} params
@param  {object} params.zipfile Reference to the parent zip file
@param  {object} params.entry   Single Zip file entry
@param  {string} params.workingDir Directory being unzipped into.
@param  {function} callback
@return {type}          description
streamFileEntry - Streaming a single uncompressed file from the zip file to the working folder .