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