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


TypeScript fs-plus.writeFileSync函数代码示例

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


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

示例1: beforeEach

 beforeEach(() => {
   workingDirectory = copySubmoduleRepository()
   repo = Repository.open(workingDirectory)
   modifiedPath = path.join(workingDirectory, 'jstips', 'README.md')
   newPath = path.join(workingDirectory, 'You-Dont-Need-jQuery', 'untracked.txt')
   cleanPath = path.join(workingDirectory, 'jstips', 'CONTRIBUTING.md')
   fs.writeFileSync(newPath, '')
   fs.writeFileSync(modifiedPath, 'making this path modified')
   newPath = fs.absolute(newPath) // specs could be running under symbol path.
 })
开发者ID:github,项目名称:ohnogit,代码行数:10,代码来源:repository-spec.ts

示例2: it

    it('trigger a status-changed event when the new status differs from the last cached one', async () => {
      const statusHandler = jasmine.createSpy('statusHandler')
      repo.onDidChangeStatus(statusHandler)
      fs.writeFileSync(filePath, '')

      await repo.getPathStatus(filePath)

      expect(statusHandler.calls.count()).toBe(1)
      const status = Git.Status.STATUS.WT_MODIFIED
      expect(statusHandler).toHaveBeenCalledWith({path: filePath, pathStatus: status})
      fs.writeFileSync(filePath, 'abc')

      await repo.getPathStatus(filePath)
      expect(statusHandler.calls.count()).toBe(1)
    })
开发者ID:github,项目名称:ohnogit,代码行数:15,代码来源:repository-spec.ts

示例3: join

    return prettier.parse().then(types => {
      const errorsPath = join(dist, `go-const-errors.log`);
      removeSync(errorsPath);
      if (prettier.errors.length) {
        writeFileSync(errorsPath, prettier.errors.join('\n'), { encoding: 'utf8' });
      }

      const promises = [
        formateWrite(join(dist, 'pipe/index-base.pipe.ts'), indexBasePipeTpl),
        formateWrite(join(dist, `pipe.ts`), pipeIndex({ types })),
        formateWrite(join(dist, `enum.ts`), enumIndex({ types })),
      ];

      types.forEach(type => {
        promises.push(
          formateWrite(join(dist, `pipe/${type.pipe}.pipe.ts`), pipeItem(type)),
          formateWrite(join(dist, `enum/${type.pipe}.enum.ts`), enumItem(type)),
          // names
          writeFile(join(dist, `names/${type.pipe}.json`), type.names),
          // xlangJson
          ...type.langs.map(lang => writeFile(join(dist, `xlang/${type.pipe}/${lang.lang}.json`), lang.langJson)),
        );
      });

      return Promise.all(promises);
    });
开发者ID:empirefox,项目名称:tompeg4,代码行数:26,代码来源:runner.ts

示例4: writeFileSync

 result => {
   if (result.error) {
     console.error('formateWrite failed', result.message);
   } else {
     writeFileSync(fileName, result.dest, { encoding: 'utf8' });
   }
 },
开发者ID:empirefox,项目名称:tompeg4,代码行数:7,代码来源:format-write.ts

示例5: connect

 return connect(this.config.driver).then(async c => {
   const { column, value, dist } = this.config;
   const query = c.getRepository(Phone)
     .createQueryBuilder('p')
     .select('phone')
     .where(`p."${column}" = :v`, { v: value });
   const ps = await query.getRawMany();
   c.close();
   const list = ps.map((p: Phone) => p.phone).join('\n');
   writeFileSync(dist, list, { encoding: 'utf8' });
 });
开发者ID:empirefox,项目名称:tompeg4,代码行数:11,代码来源:runner.ts


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