cli.js 399 B

123456789101112131415161718192021
  1. #!/usr/bin/env node
  2. var extract = require('./')
  3. var args = process.argv.slice(2)
  4. var source = args[0]
  5. var dest = args[1] || process.cwd()
  6. if (!source) {
  7. console.error('Usage: extract-zip foo.zip <targetDirectory>')
  8. process.exit(1)
  9. }
  10. extract(source, {dir: dest}, function (err, results) {
  11. if (err) {
  12. console.error('error!', err)
  13. process.exit(1)
  14. } else {
  15. process.exit(0)
  16. }
  17. })