Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I got a quick question. I want to save the value (string) of this statement:
process.stdout.write(d);
in a variable. But all my attempts failed so how is it done?
res.on('data', (d) => { process.stdout.write(d); });
You can do it like this
var str = ""; res.on('data', (d) => { str+=d; }).on('end',()=>{ console.log(str); });
Here we append the data d we get from stream, we append it to str variable & the print the str once the stream completes reading
d
str
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.