from Hacker News

Node.js stream handbook

by hoggle on 12/19/14, 2:03 PM with 17 comments

  • by hoggle on 12/19/14, 4:46 PM

    Also by the magnificent substack, learning by doing done right: the node.js stream adventure!

    Install via:

       npm install -g stream-adventure
    
    Now simply go forth and start your adventure by typing:

       stream-adventure
    
    Have fun and don't forget to thank the man:

    https://github.com/substack/stream-adventure

    https://twitter.com/substack

  • by shortstuffsushi on 12/19/14, 5:19 PM

    Not hoping to start any sort of flame war, but could someone try to explain this difference between streams and promises? The conceptual difference doesn't seem completely clear to me.
  • by dpweb on 12/19/14, 3:36 PM

    This is a great write-up on streams. For curiosity sake, I'd be interested to know the overhead of

        var stream = fs.createReadStream(__dirname + '/data.txt');
        stream.pipe(res);
    
    vs. fs.readFile('./data.txt) and res().

    and if streams become a better and better option as response sizes get larger and larger. The streams syntax is nicer looking in any case.

  • by yudong on 12/19/14, 7:35 PM

    Will it work with LIVE video streaming?

    For example, can you use ffmpeg to pull live video via rtsp, re-encode and pipe to nodejs for it to stream down to browser and to be consumed by html - with or without a plugin?

    Any working code sample?

  • by fibo on 12/19/14, 6:40 PM

    Can't believe it was not in HN yet