本文整理汇总了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();
})
示例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);
示例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')
})
示例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)
})
示例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;
}
}
}
}
示例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();
},
示例7: remove
export function remove(path:string) {
var isFile = FS.statSync(path).isFile();
if (isFile)
FS.unlinkSync(path);
else
FS.rmdirSync(path);
}
示例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");
})
示例9: afterAll
afterAll(() => {
try {
fs.unlinkSync(fileName);
fs.rmdirSync(tmpDir);
} catch (_) {
}
});