當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。