本文整理汇总了TypeScript中mkdirp.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript mkdirp.default方法的具体用法?TypeScript mkdirp.default怎么用?TypeScript mkdirp.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mkdirp
的用法示例。
在下文中一共展示了mkdirp.default方法的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);
示例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();
});
});
});
}
});
示例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();
});
};
示例4: mkdirp
return new Promise<any>(function (resolve, reject) {
mkdirp(path, function (err: Error, made: string) {
if (err) reject(err);
resolve(made);
});
});
示例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();
});
});
});
}
});
示例6: 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);
});
示例7: Promise
return new Promise((resolve, reject) => {
mkdirp(targetDirectory, error => {
if (error) {
return reject(error);
}
resolve();
});
});
示例8: Promise
return new Promise((resolve, reject) => {
mkdirp(path, (err) => {
if (err) {
reject(err)
} else {
resolve(path)
}
})
})
示例9: 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();
});
});
});
示例10: Promise
return new Promise((resolve, reject) => {
mkdirp(ctx.outputDir, function mkdirpCallback(error) {
if (error) {
reject(error);
return;
}
resolve(ctx);
});
});