NuxtN
Nuxt17mo ago
1 reply
Khov

How to read/write files in Nuxt server?

Hello everyone,
I encounter a problem with my project when switching to production (npm run build). In development (npm run dev), everything works perfectly, but in production, I get the following error:

ENOENT: no such file or directory, open '/workspaces/RevoJustify/.output/assets/config/signatures/RVJSTF-X9P0XI1N50


Code :
const signaturePath = path.resolve(process.cwd(), 'assets', 'config', signature);
const signatureBase64 = (await fs.readFile(signaturePath)).toString('base64');


How to read and write files (on the production) with Nuxt (knowing that I perform these actions in an API SERVER route)?

Thank you in advance and have a good evening.
image.png
Was this page helpful?