|
|
|
@ -84,4 +84,42 @@ export class FileUtils {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export class DocumentDirectory {
|
|
|
|
|
|
|
|
constructor(filepath: string) {
|
|
|
|
|
|
|
|
if (fs.existsSync(filepath)) {
|
|
|
|
|
|
|
|
let stats = fs.lstatSync(filepath);
|
|
|
|
|
|
|
|
if (stats.isDirectory()) {
|
|
|
|
|
|
|
|
let contents = fs.readdirSync(filepath);
|
|
|
|
|
|
|
|
for (let i = 0, l = contents.length; i < l; i++) {
|
|
|
|
|
|
|
|
console.log(contents[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
throw Error("attempted to scan non-directory");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
throw Error("attempted to load document directory for non-existing directory");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
children: FileNode[];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export class FileNode {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export class DirectoryNode extends FileNode {
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
|
|
|
super();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
children: FileNode[];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export class DocumentNode extends FileNode {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|