 {View} = require "atom"
 _ = require "underscore"
-AdmZip = require 'adm-zip'
+zip = require '../../utils/zip'
 path = require 'path'
 fs = require 'fs'
 request = require 'request'

    # show up
    .then (map) =>
      @showPackageList map
    .catch (err) ->
      console.log err.message
      console.trace err.stack


  validateAttach: (id) ->
    request_get "#{C_Server}/bsl-web/mam/attachment/readfile/#{id}"

  uploadAttach: (zipPath) ->

    Q.Promise (resolve, reject, notify) ->
      r = request.post "#{C_Server}/bsl-web/mam/attachment/upload", (err, res, body)=>
          fs.unlink zipPath
          if err then reject(err) else resolve JSON.parse(body)

      form = r.form()
      form.append "file", fs.createReadStream(zipPath),
        filename: 'upload.zip'
        contentType: 'application/zip'

