Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: dominictarr
Fetching contributors…

Cannot retrieve contributors at this time

155 lines (87 sloc) 2.288 kB

harnessing streams

harnessing streams

the way of IO

"We should have some ways of connecting programs like garden hose--screw in another segment when it becomes when it becomes necessary to massage data in another way. This is the way of IO also."

Doug McIlroy. October 11, 1964 http://cm.bell-labs.com/who/dmr/mdmpipe.html

garden hose

readable

  • fs.createReadStream()

readable

example/readable

writable

  • fs.createWriteStream()
  • concat-stream
  • delta-stream

writable

example/writable

through streams

input to output

filters, buffering

  • zlib.createGzip()
  • through

through

example/through

buffering

  • pause-stream

pause-stream

example/buffering

throttling

  • (throttling lib)

parser/serialization streams

  • JSONStream
  • stream-serializer
  • trumpet
  • tap

example/JSONStream

duplex streams

Back and forth, like a telephone.

duplex streams

When you see a.pipe(b).pipe(a) you've probably got a duplex stream.

a.pipe(b).pipe(a)

  • duplexer

example/duplexer

duplexer

  • http-duplexer

rpc

  • dnode

dnode

example/dnode

state synchronization

  • scuttlebutt

scuttlebutt

gossip protocol

(use case: web server peering)

example/scuttlebutt

event streams

  • emit-stream

emit-stream

example/emit-stream

streams inside streams

  • mux-demux

mux-demux

example/mux-demux

streams in the browser

  • browserify
  • shoe
  • domnode
  • sorta
  • graph-stream

shoe

example/shoe

freestyle stream livecoding demo

let's build a streaming webapp that:

  • synchronizes state across all users
  • listens on a server-side event emitter
  • has an rpc control interface
  • all as streams over mux-demux
  • in node and the browser
  • across multiple servers

eof

example/freestyle

  1. npm install all the things

  2. write the code

  3. the third step is you're done

eof

Jump to Line
Something went wrong with that request. Please try again.