• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript fs-extra.mkdirs函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: prepareDiffFile

async function prepareDiffFile(
  rs: RepositorySession,
  file: DiffFile
): Promise<string> {
  if (file.sha === "UNSTAGED") {
    // use file in the repository directly
    return path.join(rs.repoPath, file.path);
  }

  let absPath: string;
  if (file.sha === "STAGED") {
    const fileName = path.basename(file.path);
    const tempFileName = `STAGED-${randomName(6)}-${fileName}`;
    // TODO: check file name conflict
    absPath = path.join(rs.tempdir, tempFileName);
  } else {
    // TODO: shorten path
    absPath = path.join(rs.tempdir, file.sha, file.path);
    const parentDir = path.dirname(absPath);
    if (!(await fs.pathExists(parentDir))) {
      await fs.mkdirs(parentDir);
    }
  }
  if (await fs.pathExists(absPath)) {
    return absPath;
  }
  await git.saveTo(rs.repoPath, file.path, file.sha, absPath);
  return absPath;
}
开发者ID:wonderful-panda,项目名称:inazuma,代码行数:29,代码来源:actions.ts


示例2: setupProject

 async function setupProject() {
   await fs.remove(testModulePath);
   await fs.mkdirs(testModulePath);
   await fs.writeFile(path.resolve(testModulePath, 'package.json'), await fs.readFile(path.resolve(__dirname, '../fixture/native_app/package.json'), 'utf8'));
   await yarnOrNpmSpawn(hasYarn() ? [] : ['install'], {
     cwd: testModulePath,
     stdio: process.platform === 'win32' ? 'inherit' : 'pipe',
   });
 }
开发者ID:balloonzzq,项目名称:electron-forge,代码行数:9,代码来源:rebuild_spec_slow.ts


示例3: asyncOra

  await asyncOra('Initializing Project Directory', async (initSpinner) => {
    d('creating directory:', dir);
    await fs.mkdirs(dir);

    const files = await fs.readdir(dir);
    if (files.length !== 0) {
      d('found', files.length, 'files in the directory.  warning the user');
      initSpinner.stop(logSymbols.warning);
      throw `The specified path: "${dir}" is not empty, do you wish to continue?`;
    }
  });
开发者ID:balloonzzq,项目名称:electron-forge,代码行数:11,代码来源:init-directory.ts


示例4: function

    http.createServer(app).listen(app.get('port'), function () {       

        fs.mkdirs(path.join(__dirname, '/config'));
        fs.mkdirs(path.join(__dirname, '/views'));

        fs.copy(path.join(__dirname + '/../server/config'), path.join(__dirname, '/config') , function (err) {
          if (err) return console.error(err);

          new InitialData(db).verifyData();

        });    

        fs.copy(path.join(__dirname + '/../server/views'), path.join(__dirname, '/views') , function (err) {
          if (err) return console.error(err);

          console.log("views copied!")
        }); 

        
         //livereload(app, { watchDir: path.join(__dirname, '../build')});

        console.log("Express server listening on port " + app.get('port'));
         console.log("Service file from ..." +  path.join(__dirname, '/build'));
    });
开发者ID:ramesh-sharma12,项目名称:email-client,代码行数:24,代码来源:boot.ts


示例5: asyncOra

  await asyncOra('Copying Starter Files', async () => {
    const tmplPath = path.resolve(__dirname, '../../../tmpl');

    d('creating directory:', path.resolve(dir, 'src'));
    await fs.mkdirs(path.resolve(dir, 'src'));
    const rootFiles = ['_gitignore'];
    if (copyCIFiles) rootFiles.push(...['_travis.yml', '_appveyor.yml']);
    const srcFiles = ['index.js', 'index.html'];

    for (const file of rootFiles) {
      await copy(path.resolve(tmplPath, file), path.resolve(dir, file.replace(/^_/, '.')));
    }
    for (const file of srcFiles) {
      await copy(path.resolve(tmplPath, file), path.resolve(dir, 'src', file));
    }
  });
开发者ID:balloonzzq,项目名称:electron-forge,代码行数:16,代码来源:init-starter-files.ts


示例6: Boolean

    Object.keys(availableLanguages).map(async (availableLanguage) => {
      const messagesJsonStr = await transifex.translationInstanceMethodAsync(
        projectSlug,
        resourceSlug,
        availableLanguage,
        {mode: 'onlytranslated'}
      )
      const messagesJson: Messages = JSON.parse(messagesJsonStr)

      const sortedMessagesJson = Object.keys(messagesJson)
        .filter((key) => Boolean(R.path([key, 'message'], messagesJson)))
        .sort()
        .reduce((obj: Messages, key) => {
          // trim message
          if (messagesJson[key].message) {
            messagesJson[key].message = messagesJson[key].message.trim()
          }

          return {
            ...obj,
            [key]: messagesJson[key]
          }
        }, {})

      let mappedLanguage = ''
      switch (availableLanguage) {
        case 'nb_NO':
          mappedLanguage = 'nb'
          break

        default:
          mappedLanguage = availableLanguage
      }

      await fs.mkdirs(path.join(localesPath, mappedLanguage))

      await fs.outputJson(
        path.join(localesPath, mappedLanguage, 'messages.json'),
        sortedMessagesJson,
        {spaces: 2}
      )

      console.log(`"${mappedLanguage}" is generated`)
    })
开发者ID:foray1010,项目名称:Popup-my-Bookmarks,代码行数:44,代码来源:generateLocalesFromTransifex.ts


示例7: beforeEach

 beforeEach(async () => {
   makeStub.returns(fakeMake('darwin'));
   const dryPath = path.resolve(dir, 'out', 'publish-dry-run');
   await fs.mkdirs(dryPath);
   await fs.writeFile(path.resolve(dryPath, 'hash.json'), 'test');
   await publish({
     dir,
     interactive: false,
     dryRun: true,
   });
   expect(await fs.pathExists(path.resolve(dryPath, 'hash.json'))).to.equal(false, 'previous hashes should be erased');
   const backupDir = path.resolve(dir, 'out', 'backup');
   await fs.move(dryPath, backupDir);
   makeStub.returns(fakeMake('win32'));
   await publish({
     dir,
     interactive: false,
     dryRun: true,
   });
   for (const backedUp of await fs.readdir(backupDir)) {
     await fs.copy(path.resolve(backupDir, backedUp), path.resolve(dryPath, backedUp));
   }
 });
开发者ID:balloonzzq,项目名称:electron-forge,代码行数:23,代码来源:publish_spec.ts


示例8:

	}
);
fs.copySync(src, dest,
	{
		overwrite: true,
		preserveTimestamps: true,
		filter: /.*/
	}
);
fs.createFile(file).then(() => {
	// stub
});
fs.createFile(file, errorCallback);
fs.createFileSync(file);

fs.mkdirs(dir).then(() => {
	// stub
});
fs.mkdirp(dir).then(() => {
	// stub
});
fs.mkdirs(dir, errorCallback);
fs.mkdirsSync(dir);
fs.mkdirp(dir, errorCallback);
fs.mkdirpSync(dir);

fs.outputFile(file, data).then(() => {
	// stub
});
fs.outputFile(file, data, errorCallback);
fs.outputFileSync(file, data);
开发者ID:gilamran,项目名称:DefinitelyTyped,代码行数:31,代码来源:fs-extra-tests.ts


示例9:

		clobber: true,
		preserveTimestamps: true,
		filter: (src: string) => { return false; }
	}
);
fs.copySync(src, dest,
	{
		clobber: true,
		preserveTimestamps: true,
		filter: /.*/
	}
);
fs.createFile(file, errorCallback);
fs.createFileSync(file);

fs.mkdirs(dir, errorCallback);
fs.mkdirs(dir, {}, errorCallback);
fs.mkdirsSync(dir);
fs.mkdirsSync(dir, {});
fs.mkdirp(dir, errorCallback);
fs.mkdirp(dir, {}, errorCallback);
fs.mkdirpSync(dir);
fs.mkdirpSync(dir, {});

fs.outputFile(file, data, errorCallback);
fs.outputFileSync(file, data);
fs.outputJson(file, data, errorCallback);
fs.outputJSON(file, data, errorCallback);

fs.outputJsonSync(file, data);
fs.outputJSONSync(file, data);
开发者ID:YousefED,项目名称:DefinitelyTyped,代码行数:31,代码来源:fs-extra-tests.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript fs-extra.mkdirsSync函数代码示例发布时间:2022-05-25
下一篇:
TypeScript fs-extra.mkdirpSync函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap