本文整理汇总了TypeScript中decompress.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: resolve
out.once('finish', () => {
decompress(tmpPath, SERVER_FOLDER).then(files => {
closeDownloadProgressItem();
return resolve(true);
}).catch(err => {
closeDownloadProgressItem();
return reject(err);
});
});
示例2: decompress
return new Promise<void>((resolve, reject) => {
decompress(pkg.tmpFile.name, pkg.installPath).then(files => {
logger.appendLine(`Done! ${files.length} files unpacked.\n`);
resolve();
}).catch(decompressErr => {
logger.appendLine(`[ERROR] ${decompressErr}`);
reject(decompressErr);
});
});
示例3: decompress
.then(() => {
decompress(zipPath, dest)
.then(() => {
remove(zipPath).then(() => {
resolve();
});
})
.catch(e => {
reject(e);
});
})
示例4: decompress
outStream.once('finish', () => {
// At this point, the asset has finished downloading.
log(`[INFO] Download complete!`);
log(`[INFO] Decompressing...`);
return decompress(tmpPath, installDirectory)
.then(files => {
log(`[INFO] Done! ${files.length} files unpacked.`);
return resolve(true);
})
.catch(err => {
log(`[ERROR] ${err}`);
return reject(err);
});
});
示例5: decompress
outStream.once('finish', () => {
// At this point, the asset has finished downloading.
output.appendLine(`[INFO] Download complete!`);
output.appendLine(`[INFO] Decompressing...`);
return decompress(tmpPath, DefaultInstallLocation)
.then(files => {
output.appendLine(`[INFO] Done! ${files.length} files unpacked.`)
return resolve(true);
})
.catch(err => {
output.appendLine(`[ERROR] ${err}`);
return reject(err);
});
});
示例6: installWordPressSource
// Installs WordPress from source for projects not using the wp-starter Composer package.
async function installWordPressSource(destination: string) {
const release = await getLatestWpRelease();
const response = await fetch(release.zipball_url);
if (!response.ok) {
const { status, statusText, url } = response;
throw new Error(
`Failed to retrieve ${
release.name
}: fetch(${url}) returned ${status} ${statusText}`,
);
}
const contents = await response.buffer();
await decompress(contents, destination, { strip: 1 });
}
示例7: decompress
export function decompress(input: string, output?: string, options?: IDecompressOptions): Promise<string[]> {
return d(input, output, _.assign(options, {
plugins: [require('decompress-targz')(), require('decompress-unzip')()]
}));
}
示例8: installGesso
async function installGesso({
branch,
repository,
targetPath: target,
}: InstallGessoOptions) {
const endpoint = new URL('https://github.com');
endpoint.pathname = posix.join(
'forumone',
repository,
'archive',
branch + '.zip',
);
const response = await fetch(String(endpoint));
if (!response.ok) {
const { status, statusText, url } = response;
throw new Error(`fetch(${url}): ${status} ${statusText}`);
}
const buffer = await response.buffer();
await decompress(buffer, target, { strip: 1 });
try {
await spawnComposer(
[
'composer',
'create-project',
'pattern-lab/edition-drupal-standard',
'pattern-lab',
'--no-interaction',
],
{ cwd: target },
);
} catch (error) {
// We ignore exceptions thrown by spawning composer, per the pre-existing 8.x-2.x setup task.
// cf. https://github.com/forumone/gesso/blob/8.x-2.x/tasks/config/shell.js#L5
}
const patternLabSourcePath = path.join(target, 'pattern-lab/source');
const starterKitPath = path.join(target, '_starter-kit');
const starterKitItems = await globby('**', {
cwd: starterKitPath,
dot: false,
});
await Promise.all(
starterKitItems.map(async item => {
const source = path.join(starterKitPath, item);
const destination = path.join(patternLabSourcePath, item);
return moveFile(source, destination);
}),
);
await rimrafAsync(starterKitPath);
const gessoPackagePath = path.join(target, 'package.json');
const gessoPackage = JSON.parse(await readFile(gessoPackagePath, 'utf-8'));
// The gessoSetup command isn't container-friendly - it tries to run composer, which,
// in a node container, will fail. We tweak it unobtrusively here when installing the
// theme rather than requiring more extensive breakage upstream.
if (
gessoPackage.scripts &&
gessoPackage.scripts.postinstall === 'grunt gessoSetup'
) {
delete gessoPackage.scripts.postinstall;
await writeFile(gessoPackagePath, JSON.stringify(gessoPackage, null, ' '));
}
}