@kawalir/extension-node 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
New
|
|
1
|
+
New methods Folder.testExistence and Folder.list
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FileFunctions as FF } from "@kawalir/extension-node/Core/Functions";
|
|
2
|
+
import { Path, FileSystem } from "@kawalir/extension-node/External";
|
|
2
3
|
import { TextFile } from "./TextFile";
|
|
3
4
|
|
|
4
5
|
export class Folder {
|
|
@@ -6,6 +7,12 @@ export class Folder {
|
|
|
6
7
|
|
|
7
8
|
public getFile = (name: string) => new TextFile(this.getPath(name));
|
|
8
9
|
|
|
10
|
+
public list = () =>
|
|
11
|
+
FileSystem.readdirSync(this.path, {
|
|
12
|
+
recursive: true,
|
|
13
|
+
encoding: "utf8",
|
|
14
|
+
}).map((p) => this.getPath(p));
|
|
15
|
+
|
|
9
16
|
public getSubFolder = (relativePath: string) =>
|
|
10
17
|
new Folder(this.getPath(relativePath));
|
|
11
18
|
|
|
@@ -13,6 +20,8 @@ export class Folder {
|
|
|
13
20
|
|
|
14
21
|
public ensure = () => FF.Folder.ensure(this.path);
|
|
15
22
|
|
|
23
|
+
public testExistence = () => FF.Folder.testExistence(this.path);
|
|
24
|
+
|
|
16
25
|
public delete = () => FF.Folder.delete(this.path);
|
|
17
26
|
|
|
18
27
|
public get parent(): Folder {
|