當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript mkdirp類代碼示例

本文整理匯總了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;未經允許,請勿轉載。