Where is the documentation on res.on('end'

Where is the documentation on res.on('end'



Just cant find it! looking for documentation on the following on error, data, and end


return new Promise((resolve, reject) =>
https.get(setUrl(substr), (res) =>
let data = ''
res.on('data', (d) =>
data += d
);
res.on('end', () => resolve(data));
).on('error', reject);
);





It's probably part of the documentation for https.get(). You don't tell us what kind of object https is, so it's hard to say more without a lot of guessing.
– Ted Hopp
Sep 2 at 6:10


https.get()


https





@TedHopp - https is the https module built into node.js.
– jfriend00
Sep 2 at 18:24


https




1 Answer
1



In the doc for https.get(), it says to go look at the doc for http.get() for the callback parameters.


https.get()


http.get()



There it says:



The callback is invoked with a single argument that is an instance of http.IncomingMessage.


http.IncomingMessage



And, if you then go look at the doc for http.IncomingMessage, you find that:


http.IncomingMessage



It implements the Readable Stream interface, as well as the following additional events, methods, and properties.



In that doc, you will find a description of the data and end events.


data


end



The https.get() itself returns an http.ClientRequest object and in the doc for http.request() which https.get() is derived from, it explains:


https.get()


http.ClientRequest


http.request()


https.get()



If any error is encountered during the request (be that with DNS resolution, TCP level errors, or actual HTTP parse errors) an 'error' event is emitted on the returned request object. As with all 'error' events, if no listeners are registered the error will be thrown.



Yes, it is work to follow all this. This is one of the aspects of object oriented design with lots of derived and common objects. You have to find the object being used or perhaps even the base object and then go look in its doc for find out how to use it.



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Some of your past answers have not been well-received, and you're in danger of being blocked from answering.



Please pay close attention to the following guidance:



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)