Send file as response using NextJS API
Answering my own question here for those who’re curious to know too.. I made a thread about it in NextJS and they gave me a good answer to this – here 2 ways of doing this is either by using readStream var filePath = path.join(__dirname, ‘myfile.mp3’); var stat = fileSystem.statSync(filePath); response.writeHead(200, { ‘Content-Type’: ‘audio/mpeg’, ‘Content-Length’: … Read more