function unzip(src, dst) {
  return load(src).then(zip => {
    let promisedDirs = new Map;
    let promises = [];

    zip.z_.forEach((relPath, file) => {
      let p;
      if (file.dir) {
        p = createDir(relPath);
      } else {
        let dirname = path.dirname(relPath);
        if (dirname === '.') {
          p = writeFile(relPath, file);
        } else {
          p = createDir(dirname).then(() => writeFile(relPath, file));
        }
      }
      promises.push(p);
    });

    return Promise.all(promises).then(() => dst);

    function createDir(dir) {
      let p = promisedDirs.get(dir);
      if (!p) {
        p = io.mkdirp(path.join(dst, dir));
        promisedDirs.set(dir, p);
      }
      return p;
    }

    function writeFile(relPath, file) {
      return file.async('nodebuffer')
          .then(buffer => io.write(path.join(dst, relPath), buffer));
    }
  });
}
function unzip(src, dst) {
  return load(src).then(zip => {
    let promisedDirs = new Map;
    let promises = [];

    zip.z_.forEach((relPath, file) => {
      let p;
      if (file.dir) {
        p = createDir(relPath);
      } else {
        let dirname = path.dirname(relPath);
        if (dirname === '.') {
          p = writeFile(relPath, file);
        } else {
          p = createDir(dirname).then(() => writeFile(relPath, file));
        }
      }
      promises.push(p);
    });

    return Promise.all(promises).then(() => dst);

    function createDir(dir) {
      let p = promisedDirs.get(dir);
      if (!p) {
        p = io.mkdirp(path.join(dst, dir));
        promisedDirs.set(dir, p);
      }
      return p;
    }

    function writeFile(relPath, file) {
      return file.async('nodebuffer')
          .then(buffer => io.write(path.join(dst, relPath), buffer));
    }
  });
}
function unzip ( src , dst ) { return load ( src ) . then ( zip => { let promisedDirs = new Map ; let promises = [ ] ; zip . z_ . forEach ( ( relPath , file ) => { let p ; if ( file . dir ) { p = createDir ( relPath ) ; } else { let dirname = path . dirname ( relPath ) ; if ( dirname === '.' ) { p = writeFile ( relPath , file ) ; } else { p = createDir ( dirname ) . then ( ( ) => writeFile ( relPath , file ) ) ; } } promises . push ( p ) ; } ) ; return Promise . all ( promises ) . then ( ( ) => dst ) ; function createDir ( dir ) { let p = promisedDirs . get ( dir ) ; if ( ! p ) { p = io . mkdirp ( path . join ( dst , dir ) ) ; promisedDirs . set ( dir , p ) ; } return p ; } function writeFile ( relPath , file ) { return file . async ( 'nodebuffer' ) . then ( buffer => io . write ( path . join ( dst , relPath ) , buffer ) ) ; } } ) ; }
Asynchronously unzips an archive file.

@param {string} src path to the source file to unzip.
@param {string} dst path to the destination directory.
@return {!Promise<string>} a promise that will resolve with `dst` once the
archive has been unzipped.
Asynchronously unzips an archive file .
Unzips a zip file into a directory