14 lines
323 B
TypeScript
14 lines
323 B
TypeScript
|
import * as fs from "fs";
|
||
|
import * as path from "node:path";
|
||
|
|
||
|
|
||
|
export class FileUtils {
|
||
|
public static listFilesInDirectory(directory: string) {
|
||
|
if(fs.lstatSync(directory).isDirectory()) {
|
||
|
return fs.readdirSync(directory).map(fileName => path.join(directory, fileName))
|
||
|
} else {
|
||
|
return [];
|
||
|
}
|
||
|
}
|
||
|
}
|