當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript adm-zip.extractAllTo函數代碼示例

本文整理匯總了TypeScript中adm-zip.extractAllTo函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript extractAllTo函數的具體用法?TypeScript extractAllTo怎麽用?TypeScript extractAllTo使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了extractAllTo函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

 temp.mkdir(dirName, function (err, dirPath) {
     try {
         zip.extractAllTo(dirName, /*overwrite*/true);
         resolve(dirName);
     } catch (e) {
         reject(e);
     }
 });
開發者ID:rlugojr,項目名稱:code-settings-sync,代碼行數:8,代碼來源:util.ts

示例2: unzipFile

export function unzipFile(zipFileName: string, dstDir: string): string[] {
  const fileList: string[] = [];
  const zip = new AdmZip(zipFileName);
  zip.extractAllTo(dstDir, true);
  for (const fileItem of zipFileList(zipFileName)) {
    fileList.push(path.resolve(dstDir, fileItem));
  }
  return fileList;
}
開發者ID:angular,項目名稱:webdriver-manager,代碼行數:9,代碼來源:file_utils.ts

示例3: unzip

  unzip(): void {
    const before = Date.now()
    this.out.action.start('Unzipping')

    const zip = new AdmZip(this.importPath)
    zip.extractAllTo(this.importDir)

    this.out.action.stop(chalk.cyan(`${Date.now() - before}ms`))
  }
開發者ID:ahmb84,項目名稱:prisma,代碼行數:9,代碼來源:Importer.ts

示例4: extractAll

    extractAll(extractLocation: string, overwrite: boolean) {
        var zip = new admzip(this.zipLocation);

        try {
            zip.extractAllTo(extractLocation, overwrite);
        } catch (e) {
            throw e;
        }

        return extractLocation;
    }
開發者ID:tonylegrone,項目名稱:platypi-cli,代碼行數:11,代碼來源:zip.util.ts

示例5: function

                .on('end', function () {
                    var buf = new Buffer(dataLen);

                    for (var i = 0, len = data.length, pos = 0; i < len; i++) {
                        data[i].copy(buf, pos);
                        pos += data[i].length;
                    }

                    var zip = new AdmZip(buf);
                    zip.extractAllTo(vm.getNupkgDestinationPath());
                    resolve(true);
                })
開發者ID:patriksvensson,項目名稱:cake-vscode,代碼行數:12,代碼來源:cakeDebug.ts

示例6: catch

function unzip<T extends Binary>(binary: T, outputDir: string, fileName: string): void {
  // remove the previously saved file and unzip it
  let osType = os.type();
  let mv = path.join(outputDir, binary.executableFilename(osType));
  try {
    fs.unlinkSync(mv);
  } catch(err) {}

  // unzip the file
  logger.info(binary.name + ': unzipping ' + fileName);
  let zip = new AdmZip(path.resolve(outputDir, fileName));
  zip.extractAllTo(outputDir, true);

  // rename
  fs.renameSync(path.join(outputDir, binary.name + binary.executableSuffix(osType)), mv);

  // set permissions
  if (osType !== 'Windows_NT') {
    logger.info(binary.name + ': setting permissions to 0755 for ' + mv);
    fs.chmodSync(mv, '0755');
  }
}
開發者ID:avatar-7,項目名稱:webdriver-manager,代碼行數:22,代碼來源:update.ts

示例7: catch

function unzip<T extends Binary>(binary: T, outputDir: string, fileName: string): void {
  // remove the previously saved file and unzip it
  let osType = Config.osType();
  let mv = path.resolve(outputDir, binary.executableFilename(osType));
  try {
    fs.unlinkSync(mv);
  } catch (err) {
    try {
      rimraf.sync(mv);
    } catch (err2) {
    }
  }

  // unzip the file
  logger.info(binary.name + ': unzipping ' + fileName);
  if (fileName.slice(-4) == '.zip') {
    let zip = new AdmZip(path.resolve(outputDir, fileName));
    zip.extractAllTo(outputDir, true);
  } else {
    // We will only ever get .tar files on linux
    child_process.spawnSync('tar', ['zxvf', path.resolve(outputDir, fileName), '-C', outputDir]);
  }

  // rename
  fs.renameSync(path.resolve(outputDir, binary.zipContentName(osType)), mv);

  // set permissions
  if (osType !== 'Windows_NT') {
    logger.info(binary.name + ': setting permissions to 0755 for ' + mv);
    if (binary.id() !== AndroidSDK.id) {
      fs.chmodSync(mv, '0755');
    } else {
      fs.chmodSync(path.resolve(mv, 'tools', 'android'), '0755');
      fs.chmodSync(path.resolve(mv, 'tools', 'emulator'), '0755');
      // TODO(sjelin): get 64 bit versions working
    }
  }
}
開發者ID:sjelin,項目名稱:webdriver-manager,代碼行數:38,代碼來源:update.ts

示例8: require

ďťż///<reference path="Scripts/typings/node/node.d.ts"/>

var currentScriptPath = __dirname;

var fs = require('fs');
var AdmZip = require('adm-zip');

if (process.argv.length !== 3) {
    console.log("Usage: node ExtractTypes FilePathToTypesZip");
    console.log("Example: node ExtractTypes c:\\downloads\\Rubicon_1.1_Types.zip");
    process.exit(1);
}

console.log("This process may take a few minutes...");
var zip = new AdmZip(process.argv[2]);
console.log("Processing the archive " + process.argv[2]);
var zipEntries = zip.getEntries();
console.log("Unzipping...");
var outputLocation = currentScriptPath + '\\..\\Wafle.WebUI';
zip.extractAllTo(outputLocation, true); 
開發者ID:ShamnaSkor,項目名稱:WafleProject,代碼行數:20,代碼來源:ExtractTypes.ts

示例9: unzip_file

/**
 * Unzips the file at file_path to dest_dir.
 */
function unzip_file(grunt: IGrunt, file: {src: string[]; dest: string}, dest_dir: string): void {
  grunt.log.writeln("Extracting " + path.basename(file.src[0]) + " to " + dest_dir + "...");
  var zip = new AdmZip(file.src[0]);
  zip.extractAllTo(dest_dir, /*overwrite*/true);
}
開發者ID:altoids,項目名稱:doppio,代碼行數:8,代碼來源:unzip.ts


注:本文中的adm-zip.extractAllTo函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。