File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,22 @@ const { type } = require("os");
55const { measureMemory } = require ( "vm" ) ;
66
77const file_path = "data-karyawan.txt" ;
8- const backup_path = "data-karyawan-backup.txt" ;
8+ const backup_path = "backup/ data-karyawan-backup.txt" ;
99const log_path = "logs/data-terhapus.txt" ;
1010
1111if ( ! fs . existsSync ( file_path ) ) {
1212 console . warn ( `File "${ file_path } " tidak ditemukan. Membuat file baru...` ) ;
1313 fs . writeFileSync ( file_path , "" ) ;
1414}
1515
16+ if ( ! fs . existsSync ( "logs" ) ) {
17+ fs . mkdirSync ( "logs" ) ;
18+ }
19+
20+ if ( ! fs . existsSync ( "backup" ) ) {
21+ fs . mkdirSync ( "backup" ) ;
22+ }
23+
1624let isi_file = "" ;
1725
1826try {
@@ -592,10 +600,6 @@ async function delete_data() {
592600
593601 backup_data ( ) ;
594602
595- if ( ! fs . existsSync ( "logs" ) ) {
596- fs . mkdirSync ( "logs" ) ;
597- }
598-
599603 try {
600604 fs . appendFileSync (
601605 log_path ,
You can’t perform that action at this time.
0 commit comments