I have a huge data structure that I need to dump to file:
fs.writeFile('dump.json', JSON.stringify(bigData));
The resulting file is close to 100MB and it takes several seconds to generate. While JSON.stringify runs, it blocks the event loop and my server does not handle any requests.
Is there a way to somehow split the JSON.stringify call? My bigData var is an array of objects, so I could probably write a function to serialize them separately and then stitch the JSON together, to make sure that requests can be handled in between - but are there any solutions that are already existing (external modules is fine)?