Answer the question
In order to leave comments, you need to log in
Why is END READ output, but the part before it is not output?
The console output is END READ, and the previous part is cut off. I must say right away that in previous programs this scheme worked as it should.
PS Yes, I may not see the obvious error. To some extent, I may not understand something. But I am writing a question in order to understand and understand.
Thanks in advance.
var fs=require ('fs');
var streamwrite=new fs.WriteStream(__dirname+"/read.txt",'utf-8');
var streamread=new fs.ReadStream(__dirname+"/read.txt",'utf-8');
streamread.on('data',function(chunk){
console.log("Date accepted:\n"+chunk);
streamwrite.write("Privet");
console.log("Dannie zapisani");
});
streamread.on('end',function(){
console.log("THE END READ");
});
streamread.on('error',function(err){
if(err=='ENOENT'){
console.log("File not found");
}
else{
console.error(err);
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question