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


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

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


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

示例1: generateRepoToc

export async function generateRepoToc(
  userName,
  repository,
  basePath = '/',
  useSubHeader = false
) {
  // 获取到 Repository 对象
  const repo = gh.getRepo(userName, repository);

  currentDepth = 0;

  const fileTree = await dfsWalkToGenerateFileTree(repo, '/', basePath);

  let toc;

  if (useSubHeader) {
    toc = await generateTocFromFileTreeWithSubHeader(fileTree, currentDepth);
  } else {
    toc = await generateTocFromFileTree(
      fileTree,
      `https://github.com/${userName}/${repository}/${basePath}`
    );
  }

  fs.outputFile('toc.md', toc);
}
开发者ID:wxyyxc1992,项目名称:ConfigurableAPIServer,代码行数:26,代码来源:generateTocFromRemote.ts

示例2: readFile

 readFile(join(targetPath, 'js', jsFileName), { encoding: 'utf8' }).then((file) => {
     if (buildName === 'desktop') {
         file = `(function () {\nvar module = undefined;\n${file}})();`;
     }
     outputFile(join(targetPath, 'js', jsFileName), file)
         .then(() => done());
 });
开发者ID:wavesplatform,项目名称:WavesGUI,代码行数:7,代码来源:gulpfile.ts

示例3: writeFileMap

async function writeFileMap(
    rootDir: string, files: Map<string, string>): Promise<void> {
  const promises = [];
  for (const [relPath, contents] of files) {
    const fullPath = path.join(rootDir, relPath);
    promises.push(fsExtra.outputFile(fullPath, contents));
  }
  await Promise.all(promises);
}
开发者ID:Polymer,项目名称:tools,代码行数:9,代码来源:cli.ts

示例4: getTempPath

const withTempFile = (filePath: string, bufferText: string) : PromiseLike<string> => {
    const tempFilePath = getTempPath(filePath);
    const p = Promise.defer<string>();
    fs.outputFile(tempFilePath, bufferText, (err) => {
        if (err)
            p.reject("error with file");
        else 
            p.resolve(tempFilePath);
    });
    return p.promise; 
} 
开发者ID:hedefalk,项目名称:ensime-node,代码行数:11,代码来源:server-api.ts

示例5: async

 const refresh = async () => {
   await fs.outputFile(refreshFile, '')
   spawn(
     process.execPath,
     [path.join(__dirname, '../../../lib/hooks/init/refresh-run')],
     {
       detached: !this.config.windows,
       // stdio: 'inherit',
       stdio: 'ignore',
     }
   ).unref()
 }
开发者ID:jimmyurl,项目名称:cli,代码行数:12,代码来源:refresh.ts

示例6: Promise

    return new Promise((resolve: (val: boolean) => void, reject: (val: string) => void) => {
      const filePath: string = this.getFilePath(key);
      const meta: string = JSON.stringify({
        expireTime: Math.floor((new Date()).getTime() / 1000) + duration,
      });
      const data: Buffer = new Buffer([meta, value].join('\n'));

      fs.outputFile(filePath, data, (err: string) => {
        if (err) {
          return reject(err);
        }

        resolve(true);
      });
    });
开发者ID:RapidFiring,项目名称:nodetests,代码行数:15,代码来源:file.ts

示例7: finished

 // =======================================================================================================================================
 // =======================================================================================================================================
 // =======================================================================================================================================
 function finished(config) {
     const defaultOptions: {} = {
         autoRefresh: false,
         browser: 'Google Chrome Canary',
         pollTimeout: 1200,
         debugOnly: true,
         debugFilter: 'USER_DEBUG|FATAL_ERROR',
         apiVersion: '38.0',
         deployOptions: {
             'checkOnly': false,
             'testLevel': 'runLocalTests',
             'verbose': false,
             'ignoreWarnings': true,
         },
     };
     fs.outputFile(vscode.workspace.rootPath + path.sep + 'force.json', JSON.stringify(Object.assign(defaultOptions, config), undefined, 4));
     return config;
 }
开发者ID:mgarf,项目名称:ForceCode,代码行数:21,代码来源:credentials.ts

示例8: generateToc

export async function generateToc(repoName = 'Awesome-Reference') {
  // 获取仓库的配置信息
  const repo: ReposityConfig = repos[repoName];

  const files = walkSync(repo.localPath).filter(
    path => path.endsWith('.md') && path !== 'README.md'
  );

  // 暂时不进行文件头添加操作
  // for (let file of files) {
  //   const absoluteFile = `${repo.localPath}/${file}`;

  //   // 读取文件内容
  //   let content = await readFileAsync(absoluteFile, { encoding: 'utf8' });

  //   const header = `[![返回目录](${repo.chapterHeader})](${repo.sUrl}) \n`;

  //   // 替换已经存在的图片
  //   content = content.replace(/\[!\[返回目录\]\(.*\)\]\(.*\)/g, '');

  //   content = header + content;

  //   fs.outputFile(absoluteFile, content);
  // }

  let fileTree = await generateFileTree(repo.localPath);

  let toc;

  if (repo.depth === 1) {
    toc = generateTocFromFileTree(fileTree);
  } else {
    toc = generateTocFromFileTreeWithSubHeader(fileTree, 0);
  }

  fs.outputFile('toc.md', toc);
}
开发者ID:wxyyxc1992,项目名称:ConfigurableAPIServer,代码行数:37,代码来源:generateTocFromLocal.ts

示例9: Promise

 return new Promise((resolve, reject) => {
   outputFileCB(file, data, err => err ? reject(err) : resolve());
 });
开发者ID:overlandjs,项目名称:ltd,代码行数:3,代码来源:utils.ts

示例10:

		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);

fs.readJson(file, (error: Error, jsonObject: any) => {});
fs.readJson(file, readOptions, (error: Error, jsonObject: any) => {});
fs.readJSON(file, (error: Error, jsonObject: any) => {});
fs.readJSON(file, readOptions, (error: Error, jsonObject: any) => {});

fs.readJsonSync(file, readOptions);
fs.readJSONSync(file, readOptions);
开发者ID:YousefED,项目名称:DefinitelyTyped,代码行数:30,代码来源:fs-extra-tests.ts


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