本文整理汇总了TypeScript中unzip.Parse函数的典型用法代码示例。如果您正苦于以下问题:TypeScript Parse函数的具体用法?TypeScript Parse怎么用?TypeScript Parse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Parse函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
return new Promise<void>((resolve, reject) => {
readStream
.pipe(unzip.Parse())
.pipe(writeStream)
.on('close', resolve)
.on('error', reject);
});
开发者ID:Tomdye,项目名称:dojo-cli,代码行数:7,代码来源:gitModule.ts
示例2:
response.on('end', () => {
Debug.info('PHPStubs Download Complete');
Debug.info(`Unzipping to ${this.getStubsDir()}`);
fs.createReadStream(tmp)
.pipe(unzip.Parse())
.pipe(fstream.Writer(this.getStubsDir()));
window.showInformationMessage('PHP Library Stubs downloaded and installed. You may need to re-index the workspace for them to work correctly.', 'Rebuild Now').then(item => {
this.rebuildProject();
});
});
开发者ID:HvyIndustries,项目名称:crane,代码行数:10,代码来源:Cranefs.ts
示例3: Promise
return new Promise(resolve => {
createReadStream(file.getPath(requestState))
.pipe(unzip.Parse())
.on('entry', entry => {
if (entry.type === 'File') {
archive.append(entry, {
name: this.getArchivedFilename(entry.path, file.name),
});
} else {
entry.autodrain();
}
})
.on('error', (err: Error) => logger.info(requestState, 'Error extracting from zip: %s', err.message))
.on('close', resolve);
});
开发者ID:freezy,项目名称:node-vpdb,代码行数:15,代码来源:release.storage.ts
示例4: Error
}, (res) => {
if (res.statusCode !== 200) {
console.error("Couldn't download the release:");
const err = new Error(`Unexpected status code: ${res.statusCode}`);
console.error(err.stack);
process.exit(1);
}
let rootFolderName: string;
res.pipe(unzip.Parse())
.on("entry", (entry: any) => {
if (rootFolderName == null) {
rootFolderName = entry.path;
return;
}
const entryPath = `${downloadPath}/${entry.path.replace(rootFolderName, "")}`;
if (entry.type === "Directory") mkdirp.sync(entryPath);
else entry.pipe(fs.createWriteStream(entryPath));
})
.on("close", () => { callback(); });
});
开发者ID:alphafork,项目名称:Game-Engine-superpowers-core,代码行数:22,代码来源:index.ts
示例5:
import * as unzip from 'unzip';
import * as fs from 'fs';
fs.createReadStream('path/to/archive.zip')
.pipe(unzip.Extract({ path: 'output/path' }));
fs.createReadStream('path/to/archive.zip')
.pipe(unzip.Parse())
.on('entry', (entry: unzip.Entry) => {
const fileName = entry.path;
const type = entry.type; // 'Directory' or 'File'
const size = entry.size;
if (fileName === "this IS the file I'm looking for") {
entry.pipe(fs.createWriteStream('output/path'));
} else {
entry.autodrain();
}
});
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:18,代码来源:unzip-tests.ts
注:本文中的unzip.Parse函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论