Skip to content

Commit 569a05f

Browse files
committed
Update utilities.class.js add CopyIfNotExists
1 parent 96014dc commit 569a05f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/lib/utilities.class.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { existsSync, copyFileSync } from 'fs'
2+
13
class Utility {
24
LoggerType = {
35
'info': "Info",
@@ -22,6 +24,10 @@ class Utility {
2224
if (condition) console.log(`${typeFormatted}`, text)
2325
}
2426

27+
copyIfNotExists = (location, source) => {
28+
if (!existsSync(location)) copyFileSync(source, location)
29+
}
30+
2531
#isArrayEmpty = (data = []) => {
2632
return (data === undefined || data.length === 0) ? false : true
2733
}
@@ -34,4 +40,4 @@ class Utility {
3440
}
3541

3642
export default new Utility()
37-
export const { Logger, LoggerType } = new Utility()
43+
export const { Logger, LoggerType, copyIfNotExists } = new Utility()

0 commit comments

Comments
 (0)