本文整理汇总了TypeScript中mkdirp类的典型用法代码示例。如果您正苦于以下问题:TypeScript mkdirp类的具体用法?TypeScript mkdirp怎么用?TypeScript mkdirp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了mkdirp类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: mkdirp
http.get(file, (response) => {
mkdirp(path.dirname(outputPath), (err: Error) => {
const localFile = fs.createWriteStream(outputPath);
localFile.on("finish", () => { progress++; exportWindow.setProgressBar(progress / progressMax); cb(null); });
response.pipe(localFile);
});
}).on("error", cb);
开发者ID:AgileJoshua,项目名称:superpowers-app,代码行数:7,代码来源:ipc.ts
示例2: mkdirp
zipFile.on("entry", (entry: any) => {
if (entry.fileName.indexOf(rootFolderName) !== 0) throw new Error(`Found file outside of root folder: ${entry.fileName} (${rootFolderName})`);
const filename = path.join(downloadPath, entry.fileName.replace(rootFolderName, ""));
if (/\/$/.test(entry.fileName)) {
mkdirp(filename, (err) => {
if (err != null) throw err;
progress++;
onProgress(progress / progressMax);
zipFile.readEntry();
});
} else {
zipFile.openReadStream(entry, (err: Error, readStream: NodeJS.ReadableStream) => {
if (err) throw err;
mkdirp(path.dirname(filename), (err: Error) => {
if (err) throw err;
readStream.pipe(fs.createWriteStream(filename));
readStream.on("end", () => {
progress++;
onProgress(progress / progressMax);
zipFile.readEntry();
});
});
});
}
});
开发者ID:fulopm,项目名称:superpowers-core,代码行数:27,代码来源:utils.ts
示例3: execute
return function execute() {
const example = deps.params.example || 'counter';
const dir = deps.pwd;
function streamFrintExampleToDir() {
request('https://codeload.github.com/frintjs/frint/tar.gz/master')
.on('error', deps.console.error)
.pipe(tar.x({
C: dir,
filter: path => path.indexOf(`frint-master/examples/${example}/`) === 0,
strip: 3,
}))
.on('error', deps.console.error)
.on('finish', () => deps.console.log('Done!'));
}
deps.console.log('Initializing...');
mkdirp(dir, function mkdirpCallback(error) {
if (error) {
deps.console.error(error);
return;
}
streamFrintExampleToDir();
});
};
开发者ID:Travix-International,项目名称:frint,代码行数:26,代码来源:init.ts
示例4: mkdirp
return new Promise<any>(function (resolve, reject) {
mkdirp(path, function (err: Error, made: string) {
if (err) reject(err);
resolve(made);
});
});
开发者ID:TylorS,项目名称:ts-lib,代码行数:7,代码来源:init.ts
示例5: mkdirp
zipFile.on("entry", (entry: any) => {
if (entry.fileName.indexOf(rootFolderName) !== 0) throw new Error(`Found file outside of root folder: ${entry.fileName} (${rootFolderName})`);
const filename = path.join(settings.corePath, entry.fileName.replace(rootFolderName, ""));
if (/\/$/.test(entry.fileName)) {
mkdirp(filename, (err) => {
if (err != null) throw err;
entriesProcessed++;
splashScreen.setProgressValue(zipFile.entryCount + entriesProcessed);
zipFile.readEntry();
});
} else {
zipFile.openReadStream(entry, (err: Error, readStream: NodeJS.ReadableStream) => {
if (err) throw err;
mkdirp(path.dirname(filename), (err: Error) => {
if (err) throw err;
readStream.pipe(fs.createWriteStream(filename));
readStream.on("end", () => {
entriesProcessed++;
splashScreen.setProgressValue(zipFile.entryCount + entriesProcessed);
zipFile.readEntry();
});
});
});
}
});
开发者ID:nitpum,项目名称:superpowers-app,代码行数:27,代码来源:updateManager.ts
示例6: Promise
return new Promise((resolve, reject) => {
mkdirp(targetDirectory, error => {
if (error) {
return reject(error);
}
resolve();
});
});
开发者ID:castrors,项目名称:bloc,代码行数:8,代码来源:extension.ts
示例7: Promise
return new Promise((resolve, reject) => {
mkdirp(path, (err) => {
if (err) {
reject(err)
} else {
resolve(path)
}
})
})
开发者ID:haimich,项目名称:billy,代码行数:9,代码来源:fileProvider.ts
示例8: mkdirp
server.data.assets.acquire(assetId, null, (err: Error, asset: SupCore.Data.Base.Asset) => {
const folderPath = `${buildPath}/assets/${server.data.entries.getStoragePathFromId(assetId)}`;
mkdirp(folderPath, (err) => {
asset.save(folderPath, (err) => {
server.data.assets.release(assetId, null);
cb();
});
});
});
开发者ID:Wend1go,项目名称:superpowers-game,代码行数:9,代码来源:index.ts
示例9: Promise
return new Promise((resolve, reject) => {
mkdirp(ctx.outputDir, function mkdirpCallback(error) {
if (error) {
reject(error);
return;
}
resolve(ctx);
});
});
开发者ID:Travix-International,项目名称:frint,代码行数:9,代码来源:new.ts
示例10: checkPathAuthorization
checkPathAuthorization(folderPath, (normalizedFolderPath, authorization) => {
if (authorization !== "readWrite") {
callback(new Error(`Access to "${normalizedFolderPath}" hasn't been authorized for read/write.`));
return;
}
fsMkdirp(normalizedFolderPath, callback);
});
开发者ID:MSylvia,项目名称:superpowers-app,代码行数:8,代码来源:index.ts
注:本文中的mkdirp类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论