From 4e0a04148a14dbd11fe75309525c4808608debe5 Mon Sep 17 00:00:00 2001 From: Sewmina Date: Thu, 12 Sep 2024 16:42:35 +0530 Subject: [PATCH] local Save to var --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index f6e0e2a..27ae32d 100644 --- a/index.js +++ b/index.js @@ -15,7 +15,7 @@ app.get('/getRandomLink', async (req, res) => { const buffer = Buffer.from(response.data, 'binary'); const fileName = `image_${Date.now()}.png`; - const filePath = path.join(__dirname, 'downloads', fileName); + const filePath = path.join('/var/www/html/randomPfp/', fileName); await fs.mkdir(path.dirname(filePath), { recursive: true }); await fs.writeFile(filePath, buffer); @@ -24,7 +24,7 @@ app.get('/getRandomLink', async (req, res) => { }; const localImagePath = await downloadAndSaveImage(); - res.json({ link: pfp() }); + res.json({ link: pfp(), localLink: `https://vps.playpoolstudios.com/randomPfp/${fileName}` }); });