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

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

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

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



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

示例1: assertDirsEqual

function assertDirsEqual(actual: string, expected: string, basedir = actual) {
  if (process.env['UPDATE_POLYMER_CLI_GOLDENS']) {
    fsExtra.emptyDirSync(expected);
    fsExtra.copySync(actual, expected);
    throw new Error('Goldens updated, test failing for your saftey.');
  }

  const actualNames = fs.readdirSync(actual).sort();
  const expectedNames = fs.readdirSync(expected).sort();
  assert.deepEqual(
      actualNames,
      expectedNames,
      `expected files in directory ${path.relative(basedir, actual)}`);
  for (const fn of actualNames) {
    const subActual = path.join(actual, fn);
    const subExpected = path.join(expected, fn);
    const stat = fs.statSync(subActual);
    if (stat.isDirectory()) {
      assertDirsEqual(subActual, subExpected, basedir);
    } else {
      const actualContents = fs.readFileSync(subActual, 'utf-8').trim();
      const expectedContents = fs.readFileSync(subExpected, 'utf-8').trim();
      assert.deepEqual(
          actualContents,
          expectedContents,
          `expected contents of ${path.relative(basedir, subActual)}`);
    }
  }
}
开发者ID:poehlmann,项目名称:EvaluacionDiferencialDeLaMemoria,代码行数:29,代码来源:build_test.ts


示例2: clear

  /**
   * 清空 DEST 目录
   */
  clear () {
    let { isClear } = this.options
    if (!isClear) return

    Global.clear()
    xcxNext.clear()
    xcxNodeCache.clear()
    fs.emptyDirSync(config.getPath('dest'))
  }
开发者ID:bbxyard,项目名称:bbxyard,代码行数:12,代码来源:Xcx.ts


示例3: cleanupOldScreenshots

function* cleanupOldScreenshots() {
  console.log("Cleaning up screenshots directory");
  try {
    fsa.emptyDirSync(SCREENSHOTS_DIRECTORY);
    fsa.rmdirSync(SCREENSHOTS_DIRECTORY);
  } catch(e) {
    console.warn(`Cannot cleaup directory ${SCREENSHOTS_DIRECTORY}: `, e);
  }

  fsa.mkdirpSync(SCREENSHOTS_DIRECTORY);
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:11,代码来源:screenshots.ts


示例4: build

 .then((previousFileSizes: Object) => {
   // Remove all content but keep the directory so that
   // if you're in it, you don't end up in Trash
   fs.emptyDirSync(paths.appBuild);
   // Merge with the public folder
   fs.copySync(paths.appPublic, paths.appBuild, {
     dereference: true,
     filter: file => file !== paths.appHtml,
   });
   // Start the webpack build
   return build(previousFileSizes);
 })
开发者ID:heydoctor,项目名称:medpack,代码行数:12,代码来源:build.ts


示例5: Promise

  return new Promise((resolve, reject) => {
    const logger = new Logger('clean');

    try {
      Logger.debug(`[Clean] clean: cleaning ${context.buildDir}`);

      emptyDirSync(context.buildDir);
      logger.finish();

    } catch (ex) {
      reject(logger.fail(new BuildError(`Failed to clean directory ${context.buildDir} - ${ex.message}`)));
    }
    resolve();
  });
开发者ID:Kode-Kitchen,项目名称:ionic-app-scripts,代码行数:14,代码来源:clean.ts


示例6:

testLib.addTest('mktemp', assert => {
    const TEST_DIR = `${testLib.tempDir()}/vfs-util-test`;
    const ITER_COUNT = 10;

    fs_extra.emptyDirSync(TEST_DIR);
    var fs = new node_vfs.FileVFS(TEST_DIR);
    var count = 0;

    return asyncutil.until(() => {
        ++count;
        return vfs_util
            .mktemp(fs, '/', 'tmp.XXX')
            .then((path: string) => {
                assert.ok(path.match(/\/tmp.[a-z]{3}/) !== null);
            })
            .then(() => count > ITER_COUNT);
    });
});
开发者ID:robertknight,项目名称:passcards,代码行数:18,代码来源:util_test.ts


示例7: catch

connection.onInitialize((params: InitializeParams): InitializeResult => {
  console.log('paperclip language server initialized');
  const initializationOptions = params.initializationOptions;

  workspacePath = params.rootPath;
  vls.initialize(workspacePath, initializationOptions.devToolsPort);

  documents.onDidClose(e => {
    vls.removeDocument(e.document);
  });
  connection.onShutdown(() => {
    vls.dispose();
  });

  try {
    fsa.emptyDirSync(TMP_DIRECTORY);
  } catch(e) {

  }

  try {
    fsa.mkdirpSync(TMP_DIRECTORY);
  } catch(e) {
    
  }

  const capabilities = {
    // Tell the client that the server works in FULL text document sync mode
    textDocumentSync: documents.syncKind,
    completionProvider: { resolveProvider: true, triggerCharacters: ['.', ':', '<', '"', '/', '@', '*'] },
    signatureHelpProvider: { triggerCharacters: ['('] },
    documentFormattingProvider: true,
    hoverProvider: true,
    documentHighlightProvider: true,
    documentSymbolProvider: true,
    definitionProvider: true,
    referencesProvider: true,
    colorProvider: true
  };

  return { capabilities };
});
开发者ID:cryptobuks,项目名称:tandem,代码行数:42,代码来源:pcServerMain.ts


示例8: function

import * as YAML from 'yamljs';
import * as fs from 'fs-extra';
import * as path from 'path';

// First Copy the latest docs into the source directory
fs.emptyDirSync('source/');
fs.removeSync('pre-source/docs-production/.vscode/')
fs.copySync('pre-source/docs-production', 'source');


var _versions = YAML.parse(fs.readFileSync('./_config.yml', "utf8")).versions;
var versions: Array<string> = _versions.filter(e => e !== 'latest')
for (let version of versions) {
  console.log("Preparing Version: " + version);
  fs.copySync('pre-source/docs-' + version, 'source/' + version);
}

// Escape code blocks in the markdown
enumerate_child_files_recursive('source/', function (err, results) {
  if (err) throw err;
  for (let result of results) {
    var is_md = new RegExp(".md");
    if (is_md.test(result)) {
      fs.readFile(result, 'utf8', function (err, data) {
        if (err) {
          return console.log(err);
        }
        var backtick_positions = find(data, "```"); //find positions of backticks

        for (var i = 0, backtick_positions_1 = backtick_positions; i < backtick_positions_1.length; i++) {
          var backtick_position = backtick_positions_1[i];
开发者ID:georgeedwards,项目名称:docs,代码行数:31,代码来源:build.ts


示例9:

fs.ensureFileSync(path);
fs.ensureLink(path).then(() => {
	// stub
});
fs.ensureLink(path, errorCallback);
fs.ensureLinkSync(path);
fs.ensureSymlink(path).then(() => {
	// stub
});
fs.ensureSymlink(path, errorCallback);
fs.ensureSymlinkSync(path);
fs.emptyDir(path).then(() => {
	// stub
});
fs.emptyDir(path, errorCallback);
fs.emptyDirSync(path);
fs.pathExists(path).then((_exist: boolean) => {
	// stub
});
fs.pathExists(path, (_err: Error, _exists: boolean) => { });
const x: boolean = fs.pathExistsSync(path);

fs.rename(src, dest, errorCallback);
fs.renameSync(src, dest);
fs.truncate(path, len, errorCallback);
fs.truncateSync(path, len);
fs.chown(path, uid, gid, errorCallback);
fs.chownSync(path, uid, gid);
fs.fchown(fd, uid, gid, errorCallback);
fs.fchownSync(fd, uid, gid);
fs.lchown(path, uid, gid, errorCallback);
开发者ID:gilamran,项目名称:DefinitelyTyped,代码行数:31,代码来源:fs-extra-tests.ts


示例10: ok_all_tests

import {Setting, Ids}  from './../lib/setting';
import * as fs from 'fs-extra';
import * as path from 'path';
import {Model} from './../lib/model';
import * as _ from 'underscore';
import { Tuls as $t} from './test-utils';

import {CmdUtils} from './../lib/cmd-utils';

import * as child_process from 'child_process';

var assert = chai.assert;

let indir = path.join(Setting.test_items_dir);
let outdir = path.join(Setting.test_out_dir);
fs.emptyDirSync(outdir);
let firststep = () => {
  Setting.reset();
  Setting.postinit();
  Setting.mp_console = false;
};
//Init
Setting.postinit();
Setting.mp_console = false;

function ok_all_tests(ppath: string) {
  let _indir = path.join(indir, ppath);
  let _outdir = path.join(outdir, ppath);
  describe('check ' + ppath, () => {
    it('should be ok', () => {
      firststep();
开发者ID:do5,项目名称:mcgen,代码行数:31,代码来源:test.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript fs-extra.ensureDir函数代码示例发布时间:2022-05-25
下一篇:
TypeScript fs-extra.emptyDir函数代码示例发布时间: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