-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathscript.cjs
More file actions
40 lines (31 loc) · 1.06 KB
/
Copy pathscript.cjs
File metadata and controls
40 lines (31 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// console.log('Hello');
const fs = require('fs');
// Read file synchronously
let data = fs.readFileSync('.env.production', 'utf8');
let date = new Date();
let newDate = date.toLocaleString();
data = data.replace(/(VITE_DATE\s*=\s*")[^"]*(")/, `$1${newDate}$2`);
// console.log(data);
fs.writeFileSync('.env.production', data);
// console.log('File written successfully!');
const https = require('https');
const url = 'https://broadwayinc.com/pp/skapi.html';
https.get(url, (response) => {
let html = '';
// A chunk of data has been received
response.on('data', (chunk) => {
html += chunk;
});
// The whole response has been received
response.on('end', () => {
fs.writeFile('public/pp.html', html, (err) => {
if (err) {
console.error('파일을 쓰는 중 오류가 발생했습니다:', err);
return;
}
// console.log('파일이 성공적으로 덮어쓰기 되었습니다.');
});
});
}).on('error', (error) => {
throw 'Error making HTTP request:';
});