Im creating a file upload system which sends a string to my api made with express. I am trying to make the api take the string and create a yml file and return the created yml.
Currently I have
fs.writeFileSync('temp.yml', file);
const actualFile = fs.readFileSync('./temp.yml', 'utf8');
const data = fs.createReadStream('./temp.yml');
// delete file fs.unlinkSync('./temp.yml');
return data;
While this gets the job done, I dont believe its the best way. How can I return the read stream or the file without creating a file in the directory? Thanks Create+Read+Stream+without+creating+file+javascript