-1

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)
    }
}
Markus Meyer
  • 3,327
  • 10
  • 22
  • 35
helyz247
  • 93
  • 5

1 Answers1

0

I have solved the issue. the error is from my gitignore file

helyz247
  • 93
  • 5
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 02 '22 at 04:23