本文整理汇总了TypeScript中tidyfolders/src/file-system.FileSystem类的典型用法代码示例。如果您正苦于以下问题:TypeScript FileSystem类的具体用法?TypeScript FileSystem怎么用?TypeScript FileSystem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileSystem类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: proxyquire
o.test('should get stats for basePath/newFile', t => {
t.plan(1);
let basePath = 'basePath'
let firstDirectory = 'newFile';
let directories = [firstDirectory];
let expectedPath = `${basePath}/${firstDirectory}`;
let nodeFsStub = {
readdirSync: (path: string) => directories,
statSync: (path: string) => {
if (path === expectedPath) {
t.pass('gets stats for correct full path');
}
return {
isDirectory: () => true
}
}
};
let FileSystem = proxyquire('tidyfolders/src/file-system', {'fs': nodeFsStub}).FileSystem;
let fileSystem = new FileSystem(moveDirStub);
fileSystem.getAllDirectories(basePath);
t.end();
});
示例2: DirectoryModelBuilder
c.test('should call into injected moveDir function', t => {
t.plan(1);
let moveDir = (target: string, into: string) => {
t.pass('moveDir called');
};
let model = new DirectoryModelBuilder().withName('model').build();
let fileSystem = new FileSystem(moveDir);
fileSystem.moveDirectory(model, 'm');
});