In my node application, I write data to a file using the write method in the createWriteStream method. Now I need to find out if the recording is complete for a particular stream or not. How can I find it.
var stream = fs.createWriteStream('myFile.txt', {flags: 'a'});
var result = stream.write(data);
writeToStream();
function writeToStream() {
var result = stream.write(data + '\n');
if (!result) {
stream.once('drain',writeToStream());
}
}
I need to call a different method for every time the recording ends. How can i do this.
source
share