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


TypeScript fs.rmdirSync函数代码示例

本文整理汇总了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;未经允许,请勿转载。