development diary

Streams are a helpful metaphor. Things go in, move in a predictable way, and come out somehwere else. It makes IO simple.

See the stream handbook

I was thinking just now that it would be nice to have a transform stream that will encrypt anything written to it, and likewise decrypt on the other side.

Pretend code

var secretSource = secretStream.encrypt({ publicKey: 'abc' })
var toPlainText = secretStream.decrypt({ privateKey: '123' })
secretSource.pipe(network(/*my address...*/))

// --------------- on the other computer ------------------

network(/*my address...*/)
    .pipe(tpPlainText)
    .pipe(through(text => console.log(text)))

// or pull stream style
S(
    secretSource,
    network(address)
)
// ----------- other computer ------------------------
S(
    network(/*address*/),
    toPlainText
    S.log()
)

real modules