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

TypeScript fs.rmdirSync函数代码示例

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

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



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

示例1: expect

            .then(x => {
                // parent dir
                expect(x.isDirectory).to.be.true;
                expect(x.children.length).to.be.equal(2);
                expect(x.name).to.be.equal(path.basename(parent));
                expect(x.path).to.be.equal(parent);

                // child dir
                const d = x.children.find(xx => xx.path === childDir);
                expect(d.isDirectory).to.be.true;
                expect(d.children.length).to.be.equal(1);

                // file parent dir
                const f = x.children.find(xx => xx.path === fileParent);
                expect(f.isDirectory).to.be.false;
                expect(f.children).to.be.undefined;

                // file child dir
                const f2 = d.children.find(xx => xx.path === fileChildDir);
                expect(f2.isDirectory).to.be.false;
                expect(f2.children).to.be.undefined;

                fs.unlinkSync(fileChildDir);
                fs.unlinkSync(fileParent);
                fs.rmdirSync(childDir);
                fs.rmdirSync(parent);
                done();
            })
开发者ID:defvar,项目名称:toyctron,代码行数:28,代码来源:files.spec.ts


示例2: expect

 Promise.then(function(fileLocations: File.AbsoluteFilePath[]) {
   expect(fileLocations).toContain({
     absolutePath: __dirname + '/tmp/test.value',
   });
   expect(fileLocations).toContain({
     absolutePath: __dirname + '/tmp/test2.value',
   });
   expect(fileLocations).toContain({
     absolutePath: __dirname + '/tmp/tmp2/test.value',
   });
   expect(fileLocations).toContain({
     absolutePath: __dirname + '/tmp/tmp3/test.value',
   });
   expect(fileLocations).toContain({
     absolutePath: __dirname + '/tmp/tmp3/tmp4/test2.value',
   });
   fs.unlinkSync(__dirname + '/tmp/tmp3/tmp4/test2.value');
   fs.rmdirSync(__dirname + '/tmp/tmp3/tmp4');
   fs.unlinkSync(__dirname + '/tmp/tmp3/test.value');
   fs.rmdirSync(__dirname + '/tmp/tmp3');
   fs.unlinkSync(__dirname + '/tmp/tmp2/test2.enum');
   fs.unlinkSync(__dirname + '/tmp/tmp2/test.value');
   fs.rmdirSync(__dirname + '/tmp/tmp2');
   fs.unlinkSync(__dirname + '/tmp/test2.value');
   fs.unlinkSync(__dirname + '/tmp/test.value');
   fs.rmdirSync(__dirname + '/tmp');
   finished();
 }, future);
开发者ID:facebook,项目名称:remodel,代码行数:28,代码来源:parallel-process-queue-test.ts


示例3:

      .then((result) => {
        t.ok(result.exists, 'file exists')
        t.equal(result.contentType, 'application/octet-stream', 'file has fall-back content type')

        // try without the gaia metadata directory
        fs.rmdirSync(Path.join(storageDir, '.gaia-metadata/12345/foo'))
        fs.rmdirSync(Path.join(storageDir, '.gaia-metadata/12345'))
        fs.rmdirSync(Path.join(storageDir, '.gaia-metadata'))
        return server.handleGet('12345', 'foo/bar.txt')
      })
开发者ID:blockstack,项目名称:blockstack-registrar,代码行数:10,代码来源:test.ts


示例4: it

 it('should not throw on folder create if overwrite is true', async () => {
   let filepath = path.join(__dirname, 'bar/')
   await workspace.createFile(filepath)
   await workspace.createFile(filepath, { overwrite: true })
   expect(fs.existsSync(filepath)).toBe(true)
   fs.rmdirSync(filepath)
 })
开发者ID:illarionvk,项目名称:dotfiles,代码行数:7,代码来源:workspace.test.ts


示例5: drop

export function drop(target: string, log: Function = function () { }) {
  let rootEntry = scan_entry(path.resolve(target))
  switch (rootEntry.type) {
    case "null":
      return
    case "file":
      throw Error(`cannot drop directory ${rootEntry.fullname} because its a file.`)
    case "directory":
      let stack = drop_stack(rootEntry.fullname)
      while (stack.length > 0) {
        let dropEntry = stack.pop()
        switch (dropEntry.type) {
          case "null": break;
          case "directory":
            log(`dropping: ${dropEntry.fullname}`);
            fs.rmdirSync(dropEntry.fullname);
            break;
          case "file":
            log(`dropping: ${dropEntry.fullname}`);
            fs.unlinkSync(dropEntry.fullname);
            break;
        }
      }
  }
}
开发者ID:sinclairzx81,项目名称:tasksmith-js,代码行数:25,代码来源:drop.ts


示例6: while

  setUp: (callback: NodeUnit.ICallbackFunction): void => {
    let paths: string[][] = [
      ['report', 'checkstyle.xml'],
      ['release', '1', 'checkstyle.xml'],
    ];

    let p: number;
    let fileName: string;
    for (p = 0; p < paths.length; p++) {
      while (paths[p].length) {
        fileName = Path.join(context.fixturesDir, ...paths[p]);
        if (FS.existsSync(fileName)) {
          if (FS.statSync(fileName).isDirectory()) {
            FS.rmdirSync(fileName);
          }
          else {
            if (FS.statSync(fileName).isFile()) {
              FS.unlinkSync(fileName);
            }
          }
        }

        paths[p].pop();
      }
    }

    if (!FS.existsSync(context.fixturesDir)) {
      mkDir.sync(context.fixturesDir);
    }

    callback();
  },
开发者ID:chadhahn,项目名称:npm-tslint-formatters,代码行数:32,代码来源:TslintFormattersConvert.ts


示例7: remove

 export function remove(path:string) {
     var isFile = FS.statSync(path).isFile();
     if (isFile) 
         FS.unlinkSync(path);
     else 
         FS.rmdirSync(path);
 }
开发者ID:Houfeng,项目名称:cats,代码行数:7,代码来源:os.ts


示例8: String

    }, (error, stdout, stderr) => {
            console.log("importing " + testCaseName + " ...");
            console.log(cmd);

            if (error) {
                console.log("importing " + testCaseName + " ...");
                console.log(cmd);
                console.log("==> error " + JSON.stringify(error));
                console.log("==> stdout " + String(stdout));
                console.log("==> stderr " + String(stderr));
                console.log("\r\n");
                return;
            }

            // copy generated file to output location
            var outputFilePath = path.join(testDirectoryPath, "iocapture0.json");
            var testCasePath = path.join(rwcTestPath, "DefinitelyTyped_" + testCaseName + ".json");
            copyFileSync(outputFilePath, testCasePath);

            //console.log("output generated at: " + outputFilePath);

            if (!fs.existsSync(testCasePath)) {
                throw new Error("could not find test case at: " + testCasePath);
            }
            else {
                fs.unlinkSync(outputFilePath);
                fs.rmdirSync(testDirectoryPath);
                //console.log("testcase generated at: " + testCasePath);
                //console.log("Done.");
            }
            //console.log("\r\n");

        })
开发者ID:001szymon,项目名称:TypeScript,代码行数:33,代码来源:importDefinitelyTypedTests.ts


示例9: afterAll

 afterAll(() => {
   try {
     fs.unlinkSync(fileName);
     fs.rmdirSync(tmpDir);
   } catch (_) {
   }
 });
开发者ID:angular,项目名称:webdriver-manager,代码行数:7,代码来源:cloud_storage_xml.spec-int.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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