本文整理匯總了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;
}