N
Nuxt5w ago
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
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');
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.
No description
1 Reply
manniL
manniL5w ago
Alexander Lichter
YouTube
Store files and K/Vs in Nuxt and Nitro - Powered by unstorage
💾 Reading and writing information is important for an application, be it for storage, caching or more. But especially with all the available runtimes and platform (think serverless, edge, ...) and storage options, it became more and more complex. Luckily, useStorage, powered by the unstorage package, can help us there! Let's see how! --- Key po...
Want results from more Discord servers?
Add your server