- // const events=require("events");
- // const util=require("util");
- // class person{
- // constructor(name){
- // this.name=name;
- // }
- // }
- // util.inherits(person,events.EventEmitter);
- // const sachin =new person("sachin");
- // const kohli= new person("kohli");
- // const people=[sachin,kohli];
- // people.forEach((person)=>{
- // person.on('speak',(msg)=>{
- // console.log(person.name+" said "+msg);
- // });
- // });
- // sachin.emit("speak","hello world");
- // kohli.emit("speak","cricket");
- //Pipes
- const http= require("http");
- const fs= require("fs");
- const server = http.createServer( ( req,res ) => {
- res.statusCode = 200;
- res . setHeader("content-type","text/html");
- const readStream = fs.createReadStream("./docs/blog1.txt","utf-8");
- readStream.pipe(res);
- });
- server.listen(4132 , "127.0.0.1" , () => {
- console.log("Server listening at port 4132..");
- });
[text] babji
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: