本文整理汇总了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);
}
});
示例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;
}
示例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`))
}
示例4: extractAll
extractAll(extractLocation: string, overwrite: boolean) {
var zip = new admzip(this.zipLocation);
try {
zip.extractAllTo(extractLocation, overwrite);
} catch (e) {
throw e;
}
return extractLocation;
}
示例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);
})
示例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');
}
}
示例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
}
}
}
示例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);
示例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);
}