21. Node.js Lessons. Writable Response Stream (res), Pipe Method. Pt.2

Upon the file ending you will see the end event, in the handler of which we will end our response by calling res.end. Thus, the outgoing connection will be closed for the file has been completely sent. The resulting code is quite versatile: