I am trying to convert base64 with the code below which is working on my localhost but whenever I push to heroku server, I get error and the conversion will not work like that of the localhost
This is my nodejs code:
export const uploadFile = async(req, res) => {
const base64 = req.body.file
const fileBuffer = Buffer.from(base64, 'base64')
try {
writeFileSync(req.body.filename, fileBuffer, function (err) {
if (err) res.status(500).json("File not created");
});
// Pack files into a CAR and send to web3.storage
const file = await getFilesFromPath(req.body.filename);
const rootCid = await client.put(file);
// Get info on the Filecoin deals that the CID is stored in
const info = await client.status(rootCid) // Promise<Status | undefined>
await unlinkSync(req.body.filename)
res.status(200).json(info.cid+".ipfs.dweb.link/"+req.body.filename)
} catch (error) {
res.status(500).json(error)
}
}