Skip to content

Commit

Permalink
CDN Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucky38i committed Jun 1, 2022
1 parent 2f283d7 commit a404412
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/cdn.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const uploadFile = async (url, buffer) => {
await uploadFile(url, buffer);
} else {
MAX_RETRY = 5;
console.log('File Uploaded');
}
} catch (e) {
console.error(e);
Expand All @@ -46,7 +47,7 @@ const upload = async (fileName, buffer) => {
try {
MAX_RETRY = 5;
const url = `${CDN_URL}/${CDN_DIR}/${fileName}`;
console.log(`Syncing file: ${fileName}`);
console.log(`Syncing file: ${LOCAL_DIR}/${fileName}`);
console.log(`Destination: ${url}`);

await uploadFile(url, buffer);
Expand Down Expand Up @@ -84,7 +85,7 @@ const execute = async () => {
const files = await readdir(LOCAL_DIR);

for (const fileName of files) {
const buffer = await readFile(`${LOCAL_DIR}${fileName}`);
const buffer = await readFile(`${LOCAL_DIR}/${fileName}`);
await upload(fileName, buffer);
await purge(fileName);
}
Expand Down

0 comments on commit a404412

Please sign in to comment.