本文整理汇总了TypeScript中decompress-zip.extract函数的典型用法代码示例。如果您正苦于以下问题:TypeScript extract函数的具体用法?TypeScript extract怎么用?TypeScript extract使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了extract函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: DecompressZip
await new Promise<void>(function (resolve, reject) {
tl.debug('Extracting ' + zipLocation + ' to ' + unzipLocation);
var unzipper = new DecompressZip(zipLocation);
unzipper.on('error', err => {
return reject(tl.loc("ExtractionFailed", err))
});
unzipper.on('extract', log => {
tl.debug('Extracted ' + zipLocation + ' to ' + unzipLocation + ' successfully');
return resolve();
});
unzipper.extract({
path: unzipLocation
});
});
示例2: DecompressZip
return new Promise<void>(function(resolve, reject) {
tl.debug("Extracting " + zipLocation + " to " + unzipLocation);
var unzipper = new DecompressZip(zipLocation);
unzipper.on("error", err => {
return reject(tl.loc("ExtractionFailed", err));
});
unzipper.on("extract", () => {
tl.debug("Extracted " + zipLocation + " to " + unzipLocation + " successfully");
return resolve();
});
unzipper.extract({
path: unzipLocation
});
});
示例3: unzip
export async function unzip(zipLocation, unzipLocation) {
var defer = Q.defer();
if(tl.exist(unzipLocation)) {
tl.rmRF(unzipLocation, false);
}
var unzipper = new DecompressZip(zipLocation);
tl.debug('extracting ' + zipLocation + ' to ' + unzipLocation);
unzipper.on('error', function (error) {
defer.reject(error);
});
unzipper.on('extract', function (log) {
defer.resolve(unzipLocation);
});
unzipper.extract({
path: unzipLocation
});
return defer.promise;
}