How to use decompress-zip - 5 common examples

To help you get started, we’ve selected a few decompress-zip examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github electron-userland / electron-builder / test / src / helpers / packTester.ts View on Github external
async function checkWindowsResult(packager: Packager, checkOptions: AssertPackOptions, artifacts: Array, nameToTarget: Map) {
  const appInfo = packager.appInfo
  let squirrel = false
  for (const target of nameToTarget.keys()) {
    if (target === "squirrel") {
      squirrel = true
      break
    }
  }
  if (!squirrel) {
    return
  }

  const packageFile = artifacts.find(it => it.file!!.endsWith("-full.nupkg"))!.file!!
  const unZipper = new DecompressZip(packageFile!!)
  const fileDescriptors = await unZipper.getFiles()

  // we test app-update.yml separately, don't want to complicate general assert (yes, it is not good that we write app-update.yml for squirrel.windows if we build nsis and squirrel.windows in parallel, but as squirrel.windows is deprecated, it is ok)
  const files = pathSorter(fileDescriptors.map(it => toSystemIndependentPath(it.path))
    .filter(it => (!it.startsWith("lib/net45/locales/") || it === "lib/net45/locales/en-US.pak") && !it.endsWith(".psmdcp") && !it.endsWith("app-update.yml") && !it.includes("/inspector/")))

  expect(files).toMatchSnapshot()

  if (checkOptions == null) {
    await unZipper.extractFile(fileDescriptors.filter(it => it.path === "TestApp.nuspec")[0], {
      path: path.dirname(packageFile),
    })
    const expectedSpec = (await fs.readFile(path.join(path.dirname(packageFile), "TestApp.nuspec"), "utf8")).replace(/\r\n/g, "\n")
    // console.log(expectedSpec)
    expect(expectedSpec).toEqual(`
github ETCDEVTeam / emerald-js / src / download / downloader.js View on Github external
return new Promise((resolve, reject) => {
      const target = path.join(path.resolve(this.basedir), this.name);

      this.emit('notify', `Unpacking ${zip} to ${target}`);

      const unzipper = new DecompressZip(zip);
      unzipper.on('error', (err) => {
        this.emit('error', err);
        reject(err);
      });
      unzipper.on('extract', () => {
        fs.chmod(target, 0o755, (moderr) => {
          if (moderr) {
            reject(moderr);
          }
          resolve(true);
        });
      });
      unzipper.extract({
        path: this.basedir,
        filter: file =>
          // https://github.com/bower/decompress-zip/blob/master/lib/file-details.js#L10
github electrode-io / electrode-native / ern-container-gen-android / src / AndroidGenerator.ts View on Github external
return new Promise((resolve, reject) => {
        const unzipper = new DecompressZip(jscAARPath)
        const unzipOutDir = createTmpDir()
        const containerJniLibsPath = path.join(
          config.outDir,
          'lib/src/main/jniLibs'
        )
        const unzippedJniPath = path.join(unzipOutDir, 'jni')
        unzipper.on('error', err => reject(err))
        unzipper.on('extract', () => {
          shell.cp('-Rf', unzippedJniPath, containerJniLibsPath)
          resolve()
        })
        unzipper.extract({ path: unzipOutDir })
      })
    } finally {
github ddnlink / ddn / packages / ddn-dapp / src / dapp.js View on Github external
return new Promise((resolve, reject) => {
            const unzipper = new DecompressZip(zippath);

            unzipper.on("error", err => {
                return reject(`Failed to decompress zip file: ${err}`);
            });

            unzipper.on("extract", () => {
                resolve();
            });

            unzipper.extract({
                path: extractpath,
                strip: 1
            });
        });
    }
github electrode-io / electrode-native / ern-container-gen-android / src / AndroidGenerator.ts View on Github external
return new Promise((resolve, reject) => {
        const unzipper = new DecompressZip(hermesAarPath)
        const unzipOutDir = createTmpDir()
        const containerJniLibsPath = path.join(
          config.outDir,
          'lib/src/main/jniLibs'
        )
        const unzippedJniPath = path.join(unzipOutDir, 'jni')
        unzipper.on('error', err => reject(err))
        unzipper.on('extract', () => {
          shell.cp('-Rf', unzippedJniPath, containerJniLibsPath)
          resolve()
        })
        unzipper.extract({ path: unzipOutDir })
      })
    } finally {

decompress-zip

Extract files from a ZIP archive

MIT
Latest version published 4 years ago

Package Health Score

54 / 100
Full package analysis

Popular decompress-zip functions