local Save to var
This commit is contained in:
parent
2d390e3cec
commit
4e0a04148a
4
index.js
4
index.js
|
|
@ -15,7 +15,7 @@ app.get('/getRandomLink', async (req, res) => {
|
||||||
const buffer = Buffer.from(response.data, 'binary');
|
const buffer = Buffer.from(response.data, 'binary');
|
||||||
|
|
||||||
const fileName = `image_${Date.now()}.png`;
|
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.mkdir(path.dirname(filePath), { recursive: true });
|
||||||
await fs.writeFile(filePath, buffer);
|
await fs.writeFile(filePath, buffer);
|
||||||
|
|
@ -24,7 +24,7 @@ app.get('/getRandomLink', async (req, res) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const localImagePath = await downloadAndSaveImage();
|
const localImagePath = await downloadAndSaveImage();
|
||||||
res.json({ link: pfp() });
|
res.json({ link: pfp(), localLink: `https://vps.playpoolstudios.com/randomPfp/${fileName}` });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user