I keep getting an EMFILE error which I believe is caused by WriteFileSync? I am writing tens of thousands of JSON files and I blow through the file limit. How can I tweak the code to fix the issue?
const writeMetaData = (_data) => {
fs.writeFileSync("./output/_metadata.json", _data);
};
Then
writeMetaData(JSON.stringify(metadataList));