@reldens/utils 0.27.0 → 0.28.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.
@@ -23,6 +23,12 @@ class FileHandler
23
23
 
24
24
  copyFile(from, to, folder)
25
25
  {
26
+ if(!this.exists(from)){
27
+ return false;
28
+ }
29
+ if(!this.exists(folder)){
30
+ return false;
31
+ }
26
32
  fs.copyFileSync(from, path.join(folder, to));
27
33
  }
28
34
 
@@ -48,10 +54,18 @@ class FileHandler
48
54
  });
49
55
  }
50
56
 
57
+ exists(fullPath)
58
+ {
59
+ if(!fs.existsSync(fullPath)){
60
+ Logger.warning(`File or folder "${fullPath}" does not exist.`);
61
+ return false;
62
+ }
63
+ return true;
64
+ }
65
+
51
66
  removeByPath(fullPath)
52
67
  {
53
- if (!fs.existsSync(fullPath)) {
54
- Logger.error(`File or folder "${fullPath}" does not exist.`);
68
+ if(!this.exists(fullPath)){
55
69
  return false;
56
70
  }
57
71
  let stats = fs.statSync(fullPath);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reldens/utils",
3
3
  "scope": "@reldens",
4
- "version": "0.27.0",
4
+ "version": "0.28.0",
5
5
  "description": "Reldens - Utils",
6
6
  "author": "Damian A. Pastorini",
7
7
  "license": "MIT",