Next.js Discord

Discord Forum

Best way to store static data?

Answered
Bee posted this in #help-forum
Open in Discord
BeeOP
Hi, I'm new to the NextJS community and trying to make heads or tails of how to store a fairly large amount of markdown in JSON form where such can be stored ideally within memory to prevent disk reading on each request. I'd prefer the JSON be accessible for when it must be changed thus ideally it would be loaded into memory on boot then referred to from then onward. Any suggestions would be of help, thank you.
Answered by Bee
Webpack caches the json and thus after the first request sends solely from memory as far as I understand.
View full answer

2 Replies

BeeOP
I did consult this [guide](https://vercel.com/guides/loading-static-file-nextjs-api-route) however, im almost certain fs.readFile is completely uncached and reads solely from disk making it a slow and unviable option
BeeOP
Webpack caches the json and thus after the first request sends solely from memory as far as I understand.
Answer