本文整理匯總了TypeScript中decompress-zip.on函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript on函數的具體用法?TypeScript on怎麽用?TypeScript on使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了on函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: getArchivedEntries
export async function getArchivedEntries(archivedPackage: string) {
var deferred = Q.defer();
var unzipper = new DecompressZip(archivedPackage);
unzipper.on('error', function (error) {
deferred.reject(error);
});
unzipper.on('list', function (files) {
var packageComponent = {
"entries":files
};
deferred.resolve(packageComponent);
});
unzipper.list();
return deferred.promise;
}
示例3: 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
});
});
示例4: 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;
}