aboutsummaryrefslogtreecommitdiff
path: root/src/systemLevelInformation.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemLevelInformation.ts')
-rw-r--r--src/systemLevelInformation.ts33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/systemLevelInformation.ts b/src/systemLevelInformation.ts
new file mode 100644
index 0000000..e902d32
--- /dev/null
+++ b/src/systemLevelInformation.ts
@@ -0,0 +1,33 @@
+import * as os from 'os';
+import * as glob from 'glob';
+import { statSync, readdirSync } from 'fs';
+import { extname, basename } from 'path';
+
+class systemLevelInformation {
+
+ getUserInfo(): { username: string, homedir: string } {
+ return {
+ username: os.userInfo().username,
+ homedir: os.userInfo().homedir
+ };
+ }
+
+ getAllFilesOfDirectory(currentDirectory): { files: string[], directories: string[] } {
+ const currentFilteredItems: string[] = readdirSync(currentDirectory).filter((item: string) => item.indexOf(".") !== 0);
+ const files: string[] = [];
+ const directories: string[] = [];
+
+ currentFilteredItems.forEach((item: string) => {
+ if (statSync(`${currentDirectory}/${item}`).isDirectory()) {
+ directories.push(item);
+ } else {
+ files.push(item);
+ }
+ });
+
+ return { files, directories };
+ }
+
+}
+
+export default new systemLevelInformation;