   tar = require 'tar'
   tarStream = inputStream.pipe(tar.Parse())
 
-  tarStream.on 'error', (error) -> callback(error)
+  tarStream.on 'error', callback
   tarStream.on 'entry', (entry) ->
     return unless filePath is entry.props.path
 


  zlib = require 'zlib'
  fileStream = fs.createReadStream(archivePath)
  fileStream.on 'error', (error) -> callback(error)
  gzipStream = fileStream.pipe(zlib.createGunzip())
  gzipStream.on 'error', (error) -> callback(error)
  readTarStream(gzipStream, callback)

listTar = (archivePath, callback) ->
  fileStream = fs.createReadStream(archivePath)
  fileStream.on 'error', (error) -> callback(error)
  readTarStream(fileStream, callback)

readTarStream = (inputStream, callback) ->
  paths = []
  tarStream = inputStream.pipe(require('tar').Parse())
  tarStream.on 'error', (error) -> callback(error)
  tarStream.on 'entry', (entry) -> paths.push(entry.props.path)
  tarStream.on 'end', -> callback(null, paths)

readFileFromZip = (archivePath, filePath, callback) ->
  fileStream = fs.createReadStream(archivePath)
  fileStream.on 'error', (error) -> callback(error)
  zipStream = fileStream.pipe(require('unzip').Parse())
  zipStream.on 'close', ->
    callback(new Error("#{filePath} does not exist in the archive: #{archivePath}"))
  zipStream.on 'error', (error) -> callback(error)
  zipStream.on 'entry', (entry) ->
    if filePath is entry.path
      contents = []

  unzip = require 'unzip'
  paths = []
  fileStream = fs.createReadStream(archivePath)
  fileStream.on 'error', callback
  zipStream = fileStream.pipe(unzip.Parse())
  zipStream.on 'close', -> callback(null, paths)
  zipStream.on 'error', callback
  zipStream.on 'entry', (entry) ->
    paths.push(entry.path)
    entry.autodrain()
