Open mifi opened 4 years ago
not sure if i'm doing something wrong, but i'm getting a memory leak when creating many FileWriters (event though ending them properly)
const path = require('path'); const WavFileWriter = require('wav').FileWriter; const outDir= './audio-rec'; setInterval(() => { const fileName = `${new Date().getTime()}.wav`; const outPath = path.join(outDir, fileName); const writer = new WavFileWriter(outPath, { sampleRate: 16000, channels: 1 }); const buf = Buffer.alloc(10000); Buffer.from([255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]).copy(buf); writer.write(buf); setTimeout(() => writer.end(), 100); }, 1);
I resorted to use ffmpeg thru child process instead, to avoid the memory leak
not sure if i'm doing something wrong, but i'm getting a memory leak when creating many FileWriters (event though ending them properly)