 semver = require 'npm/node_modules/semver'
 temp = require 'temp'
 hostedGitInfo = require 'hosted-git-info'
-
+progress = require 'progress-stream'
 config = require './apm'
 Command = require './command'
 fs = require './fs'

        callback("Unable to download #{packageUrl}: #{error.message}")
      readStream.on 'response', (response) =>
        if response.statusCode is 200
          filePath = path.join(temp.mkdirSync(), 'package.tgz')
          writeStream = fs.createWriteStream(filePath)
          readStream.pipe(writeStream)
          writeStream.on 'error', (error) ->
            callback("Unable to download #{packageUrl}: #{error.message}")
          writeStream.on 'close', -> callback(null, filePath)

        packageVersion ?= @getLatestCompatibleVersion(pack)
        unless packageVersion
          @logFailure()
          callback("Test No available version compatible with the installed Atom version: #{@installedAtomVersion}")
          return

        {tarball} = pack.versions[packageVersion]?.dist ? {}
        unless tarball
          @logFailure()
          callback(" Test Package version: #{packageVersion} not found")
          return

        commands = []
        commands.push (next) =>
          @getPackageCachePath packageName, packageVersion, (error, packagePath) =>
            if packagePath
              process.stdout.write('\nWas found in chache not downloading')
              next(null, packagePath)
            else
              @downloadPackage(tarball, installGlobally, next)
