本文整理汇总了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;
}