jcinfo-utils 1.0.33 → 1.0.34
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/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +1 -1
- package/src/utils.js +12 -0
- package/test/testar.js +4 -0
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import { updateDotEnv } from './src/updateDotEnv.js'
|
|
|
13
13
|
import { formatFileSize } from './src/formatFileSize.js'
|
|
14
14
|
import { updateVersionDate } from './src/updateVersionDate.js'
|
|
15
15
|
import { retirarAcentuacao } from './src/retirarAcentuacao.js'
|
|
16
|
+
import { fileExists } from './src/utils.js'
|
|
16
17
|
|
|
17
18
|
// ===================================================== LOGS
|
|
18
19
|
|
|
@@ -220,4 +221,5 @@ export {
|
|
|
220
221
|
updateDotEnv,
|
|
221
222
|
updateVersionDate,
|
|
222
223
|
retirarAcentuacao,
|
|
224
|
+
fileExists,
|
|
223
225
|
}
|
package/package.json
CHANGED
package/src/utils.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
|
|
3
|
+
export function fileExists(filename) {
|
|
4
|
+
try {
|
|
5
|
+
// Verifica se o arquivo existe usando fs.accessSync
|
|
6
|
+
fs.accessSync(filename, fs.constants.F_OK)
|
|
7
|
+
return true
|
|
8
|
+
} catch (err) {
|
|
9
|
+
// Se ocorrer um erro, o arquivo não existe ou não é acessível
|
|
10
|
+
return false
|
|
11
|
+
}
|
|
12
|
+
}
|