当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript mkdirp.default函数代码示例

本文整理汇总了TypeScript中mkdirp.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了default函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: createDirectory

export default async function createDirectory(args: ActionArgs) {
  const directoryName = args.nodes.text().trim()
  if (!directoryName) {
    throw new Error('empty directory name given')
  }
  args.formatter.name(`create directory ${chalk.cyan(directoryName)}`)
  const fullPath = path.join(args.configuration.workspace, directoryName)
  await mkdirp(fullPath)
}
开发者ID:Originate,项目名称:tutorial-runner,代码行数:9,代码来源:create-directory.ts

示例2: function

 zipfile.on("entry", function (entry: any) {
     let desiredPath = path.join(targetDirectory, entry.fileName);
     //let desiredPath = targetDirectory + entry.fileName;
     if (/\/$/.test(entry.fileName)) {
         // directory file names end with '/'
         mkdirp(desiredPath, function (err: any) {
             if (err) throw err;
             zipfile.readEntry();
         });
     } else {
         // file entry
         zipfile.openReadStream(entry, function (err: any, readStream: any) {
             if (err) throw err;
             // ensure parent directory exists
             mkdirp(path.dirname(desiredPath), function (err: any) {
                 if (err) throw err;
                 readStream.pipe(fs.createWriteStream(desiredPath));
                 readStream.on("end", function () {
                     zipfile.readEntry();
                     resolve();
                 });
             });
         });
     }
 });
开发者ID:into-cps,项目名称:intocps-ui,代码行数:25,代码来源:Downloader.ts

示例3: moment

    let postImageFromClipboardDisposable = vscode.commands.registerCommand('extension.writeCnblog.postImageFromClipboard', () => {
        const editor = vscode.window.activeTextEditor;
        if (!editor) {
            vscode.window.showErrorMessage("没有打开编辑窗口");
            return;
        }
        
        let folderPath = path.dirname(editor.document.fileName);
        let ext = path.extname(editor.document.fileName);
        let fileName = path.basename(editor.document.fileName,ext);

        let fileNameWithoutExt = moment().format("YYYYMMDDHHmmss") + ".png";
        let imagePath = path.join(folderPath,"Images",fileName,fileNameWithoutExt);
        let dir = path.dirname(imagePath);
        // create a directory if doesn't exist
        mkdirp(dir,(err: string)=> { 
            if (err) {  vscode.window.showErrorMessage(err) ; }
            else {
                saveClipboardImageToFileAndGetPath(imagePath, (imagePath, imagePathReturnByScript) => {
                    if (!imagePathReturnByScript) { return; }
                    if (imagePathReturnByScript === 'no image') {
                        vscode.window.showErrorMessage('There is not a image in clipboard.');
                        return;
                    }
                    //上传图片
                    pushImage(imagePath,editor);
                });
            }
        });
    });
开发者ID:kotcmm,项目名称:writecnblog,代码行数:30,代码来源:extension.ts

示例4: Promise

 await new Promise((resolve, reject) =>
   mkdirp(parentDir, err => {
     if (err) {
       reject(err);
     } else {
       resolve();
     }
   })
开发者ID:elastic,项目名称:kibana,代码行数:8,代码来源:repository_service.ts

示例5: Promise

 return new Promise((resolve, reject) => {
     mkdirp(this.getProjectDir(), (err) => {
         if (err) {
             resolve(false);
         } else {
             resolve(true);
         }
     });
 });
开发者ID:HvyIndustries,项目名称:crane,代码行数:9,代码来源:Cranefs.ts

示例6: Promise

	return new Promise((resolve, reject) => {
		mkdirp(dir, err => {
			if (err) {
				reject(err);
			}
			else {
				resolve();
			}
		});
	});
开发者ID:zenmumbler,项目名称:dtbb,代码行数:10,代码来源:importutil.ts

示例7: create

    create(name: string, data: any, layout: string): void {
        Mkdirp(this.dest, err => {
            if (err) {
                console.error(err);
            }

            let filename: string = name === 'index' ? 'index.html' : `${name}-example.html`;

            fs.writeFileSync(`${this.dest}/${filename}`, this.compile(data, layout), 'utf8');
        });
    }
开发者ID:blongden,项目名称:node-hologram,代码行数:11,代码来源:index.ts

示例8: mkdirp

 return p.then(() => {
     var deferred = q.defer();
     mkdirp(__dirname + savePath, function (err) {
         if (err) deferred.reject(err);
         page.render(savePath + "/" + saveFilename, { format: 'jpg', quality: '60' }).then(() => {
             console.log("Generated screenshot", url, savePath, saveFilename);
             deferred.resolve();
             page.close();
         });
     });
     return deferred.promise;
 });
开发者ID:huangfeng,项目名称:screenshot-generator,代码行数:12,代码来源:screenshots.ts


注:本文中的mkdirp.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。